自分のホームにCPANモジュールをいれる
Webで散見されるネタだけど
自分はこんな感じ
~/.cpan/CPAN/MyConfig 'makepl_arg' => q[LIB=~/script/perl/lib PREFIX=~/script/perl], 'ftp_proxy' => q[http://proxy.example.net:8080], 'http_proxy' => q[http://proxy.example.net:8080], 'histfile' => q[~/.cpan/histfile], # ホームじゃないとき # 'make_install_make_command' => q[/usr/bin/sudo /usr/bin/make], # 'mbuild_install_build_command' => q[/usr/bin/sudo ./Build], 'make_install_make_command' => q[/usr/bin/make], 'mbuild_install_build_command' => q[./Build],
このままだとcpanのinstallのテストが失敗するので
~/.cshrc setenv PERL5LIB ${HOME}/script/perl/lib
とする
概ねこれで問題ないが
sudoでスクリプトを動かすときは上記の環境変数を持っていくようにするか
または
use lib "$ENV{HOME}/script/perl/lib";
とする