Adobe Adobe - 2 years ago 86
Perl Question

Can't locate *** in @INC

I install perl modules in

. Here's part of

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";

I've installed

$ cpan
cpan[1]> install CSS::Inliner

and I have


But when I
it -- perl can't find it:

perl -e 'use Inliner'


Can't locate in @INC (@INC contains:
/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.

why can't perl find the module?


I'm trying to reproduce minimal working example given in documentation to CSS-Inliner:

use Inliner;

my $inliner = new Inliner();

$inliner->read_file({filename => 'myfile.html'});

print $inliner->inlinify();

If I
use Inliner
-- perl can't find it. If I


use CSS::Inliner;

my $inliner = new Inliner();

$inliner->read_file({filename => 'test.html'});

print $inliner->inlinify();

perl says

Can't locate object method "new" via package "Inliner"
(perhaps you forgot to load "Inliner"?) at ./1.perl line 5.

Edit 2:

Here's a minimal working example of


use CSS::Inliner;

my $inliner = CSS::Inliner->new;

$inliner->read_file({filename => 'test.html'});

print $inliner->inlinify();

Answer Source

You should use the full module name in use and full class name when calling class methods:

use CSS::Inliner;
my $inliner = CSS::Inliner->new;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download