Perl::Critic

perlbrew, local::libを構築(略)、cpanmを入れる→~/bin

$ cpanm Perl::Critic
えらー

$ perl Makefile.PL
Writing Makefile for Perl::Critic
Writing MYMETA.yml and MYMETA.json

Versions of optional/unlisted/indirect dependencies:

    File::HomeDir = not installed
    File::Which = not installed
    Readonly::XS = not installed
    Term::ANSIColor = 1.10

$ cpanm File::HomeDir
$ cpanm Readonly::XS

// わからないのでひとつバージョン下げたら上手くいった
$ wget http://search.cpan.org/CPAN/authors/id/E/EL/ELLIOTJS/Perl-Critic-1.115.tar.gz
$ cpanm Perl-Critic-1.115.tar.gz
    • 練習というかチェック
$ perlcritic c.pl
Subroutine prototypes used at line 6, column 1.  See page 194 of PBP.  (Severity: 5)
$ cat c.pl
# vim:set ts=2:
use strict;
use warnings;
use YAML;

sub cmap (&) {     <- プロトタイプ非推奨
  my $f = shift;
  my $r = sub {
    my @result;
    for (@_) {
      push @result, $f->($_);
    }
    @result;
  };
  return $r;
}
    • 裸のワード,open
$ perlcritic b.pl
Bareword file handle opened at line 2, column 1.  See pages 202,204 of PBP.  (Severity: 5)
Two-argument "open" used at line 2, column 1.  See page 207 of PBP.  (Severity: 5)
Code before strictures are enabled at line 2, column 1.  See page 429 of PBP.  (Severity: 5)
$ cat b.pl

open OUT, "/tmp/a"; <- ファイルハンドル$fhとかに、open は2引数じゃなくて3引数
while(<OUT>) {
}
close OUT;
$ perlcritic code/ua.pl
I/O layer ":utf8" used at line 737, column 2.  Use ":encoding(UTF-8)" to get strict validation.  (Severity: 5)

あれ?dotcloud死んでる?と思ったら繋がった

    • ssh繋ごうとしたらupgradeしろとな。
$ dotcloud xxx.xxx
Warning: A new version of the DotCloud cli is available: 0.4.3
sudo easy_install --upgrade dotcloud
$ which easy_install-2.6
~/.pythonbrew/pythons/Python-2.6.6/bin/easy_install-2.6
$ easy_install-2.6 --upgrade dotcloud
Searching for dotcloud
Reading http://pypi.python.org/simple/dotcloud/
Reading http://www.dotcloud.com/
Download error: timed out -- Some packages may not be found! <-なんかエラーリトライ
...
Finished processing dependencies for dotcloud
    • なんか死んでたくさい

tairan Tairan
Yes, dotcloud.com came back!
2分前
tairan Tairan
Oops, dotcloud.com is down now. 504 Gateway Time-out.
16分前

http://twitter.com/#!/tairan/status/131713504293036032