はじめに
perlやってると結構頻繁に使いたいけど忘れちゃうリストをいくつかメモ
何度忘れたことかw
perlのサーチパスを確認(@INC)
※ とりあえず出す # perl -e 'print @INC' /home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4/x86_64-linux/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/x86_64-linux/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4. ※ Dumper使ってみやすく出す # perl -e 'use Data::Dumper;print Dumper @INC' $VAR1 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4/x86_64-linux'; $VAR2 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4'; $VAR3 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/x86_64-linux'; $VAR4 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4'; $VAR5 = '.';
perlの読み込まれているモジュールの確認(%INC)
# perl -e 'use Data::Dumper;print Dumper %INC' $VAR1 = 'Carp.pm'; $VAR2 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/Carp.pm'; $VAR3 = 'strict.pm'; $VAR4 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/strict.pm'; $VAR5 = 'warnings/register.pm'; $VAR6 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/warnings/register.pm'; $VAR7 = 'XSLoader.pm'; $VAR8 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/XSLoader.pm'; $VAR9 = 'constant.pm'; $VAR10 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/constant.pm'; $VAR11 = 'overloading.pm'; $VAR12 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/overloading.pm'; $VAR13 = 'vars.pm'; $VAR14 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/vars.pm'; $VAR15 = 'Exporter.pm'; $VAR16 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/Exporter.pm'; $VAR17 = 'warnings.pm'; $VAR18 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/warnings.pm'; $VAR19 = 'overload.pm'; $VAR20 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/overload.pm'; $VAR21 = 'bytes.pm'; $VAR22 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/bytes.pm'; $VAR23 = 'Data/Dumper.pm'; $VAR24 = '/home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/x86_64-linux/Data/Dumper.pm';
インストールされているCPANモジュールの確認
これは@INC+findコマンドで実現します
# find `perl -e 'print "@INC"'` -name '*.pm' -print | grep FizzBuzz /home/hoge/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4/Acme/FizzBuzz.pm
おわりに
こーやった直後はしばらく覚えてるんだけどまたちょっとしたらアレ?どんなだったっけ?ってなりそうw