我在~/.local/perl5
上安裝perl模塊。下面是~/.bashrc
部分:找不到*** in @INC
export PERL_LOCAL_LIB_ROOT="$HOME/.local/perl5";
export PERL_MB_OPT="--install_base $HOME/.local/perl5";
export PERL_MM_OPT="INSTALL_BASE=$HOME/.local/perl5";
export PERL5LIB="$HOME/.local/perl5/lib/perl5:$PERL5LIB";
export PATH="$HOME/.local/perl5/bin:$PATH";
我已經安裝了CSS::Inliner
與
$ cpan
cpan[1]> install CSS::Inliner
,我有Inliner.pm
在:
~/.local/perl5/lib/perl5/CSS/Inliner.pm
但是,當我use
它 - Perl中無法找到它:
perl -e 'use Inliner'
給出:
Can't locate Inliner.pm in @INC (@INC contains:
/home/boris/.local/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
/home/boris/.local/perl5/lib/perl5 /etc/perl
/usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14
/usr/local/lib/site_perl .) at -e line 1. BEGIN failed--compilation
aborted at -e line 1.
爲什麼不使用Perl找到該模塊?
編輯:
我試圖重現文檔給出的最小工作示例CSS-Inliner:
use Inliner;
my $inliner = new Inliner();
$inliner->read_file({filename => 'myfile.html'});
print $inliner->inlinify();
如果我use Inliner
- 該Perl不能找到它。如果我
#!/usr/bin/perl
use CSS::Inliner;
my $inliner = new Inliner();
$inliner->read_file({filename => 'test.html'});
print $inliner->inlinify();
的perl說
Can't locate object method "new" via package "Inliner"
(perhaps you forgot to load "Inliner"?) at ./1.perl line 5.
編輯2:
這裏是CSS-Inliner
最小工作示例:
#!/usr/bin/perl
use CSS::Inliner;
my $inliner = CSS::Inliner->new;
$inliner->read_file({filename => 'test.html'});
print $inliner->inlinify();
@Mat:我該如何安裝[CSS-Inliner](http://search.cpan.org/~kamelkev/CSS-Inliner-3674)?我應該在'cpan'中安裝什麼? – Adobe 2013-03-14 07:16:47
@Mat:查看編輯的問題。 – Adobe 2013-03-14 07:23:14