BruceDB has asked for the wisdom of the Perl Monks concerning the following question:

Note: Working in OS X Darwin (10.4.1)

I'm running a .pl script that uses a .pm file that uses LWP::Simple. It's worked before and today I tried to execute it and am running into this problem.

When I run perl -e "use LWP::Simple;" it appears that the package (LWP::Simple) exists. I manually re-added the path to PERL5LIB. I even re-installed / updated it using MCPAN.

Yet, when I run my script I get

Can't locate LWP/Simple.pm in @INC (@INC contains: /Users/brucedb/edev +/project_psdev/dev/bruce/tools/bin/../lib /opt/local/lib/perl5/site_p +erl/5.8.9/LWP/ /System/Library/Perl/5.8.6/darwin-thread-multi-2level +/System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2l +evel /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/da +rwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library +/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /S +ystem/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at /Users/bruc +edb/edev/project_psdev/dev/bruce/tools/bin/../lib/utils.pm line 9. BEGIN failed--compilation aborted at /Users/brucedb/edev/project_psdev +/dev/bruce/tools/bin/../lib/utils.pm line 9. Compilation failed in require at ./algo.pl line 20. BEGIN failed--compilation aborted at ./algo.pl line 20.

Notes about the above error message:

1. line 20 in algo.pl is "use utils.pm;"

2. line 9 in utils.pm is "use LWP::Simple;"

3. /lib /opt/local/lib/perl5/site_perl/5.8.9/LWP/ is the directory containing Simple.

Any ideas?

Thanks,

Replies are listed 'Best First'.
Re: Can't locate LWP/Simple.pm in @INC
by toolic (Bishop) on Nov 08, 2009 at 22:19 UTC
    Add
    /opt/local/lib/perl5/site_perl/5.8.9
    instead of
    /opt/local/lib/perl5/site_perl/5.8.9/LWP
    to PERL5LIB. Then @INC will include /opt/local/lib/perl5/site_perl/5.8.9, and perl should be able to locate the LWP/Simple.pm module file when you use LWP::Simple;
      This worked! Thx!
Re: Can't locate LWP/Simple.pm in @INC
by Khen1950fx (Canon) on Nov 08, 2009 at 22:29 UTC
    I think that your utils.pm module probably can't find LWP::Simple. Did you try pmpath? Try running:

    perl -MLWP::Simple -e 'getprint "http://www.perlmonks.org"'
    and it should return the perlmonks page if you have it.
      Thanks for the feedback. The prior response worked. But thanks for showing me this way to see if LWP::Simple is installed and working.