Can't locate <module> in @INC - but I can see module is there!

J

Justin Wyllie

Hi

I'm running a program sa-learn that comes with SpamAssassin anti-spam s/w.

This script fails on this line:

require Mail::SpamAssassin::CmdLearn;

with a message saying the module can't be found in @INC. The print-out for
@INC includes:


Can't locate Mail/SpamAssassin/CmdLearn.pm in @INC (@INC contains:
/usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/5.6.1/i386-freebsd
/usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
/usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl)

and the module is installed in
usr/local/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/CmdLearn.pm

Is there any reason other than it not being there that a Perl require call
may fail?

Many thanks

Justin Wyllie
 
K

Ken

Justin said:
Hi

I'm running a program sa-learn that comes with SpamAssassin anti-spam s/w.

This script fails on this line:

require Mail::SpamAssassin::CmdLearn;

with a message saying the module can't be found in @INC. The print-out for
@INC includes:


Can't locate Mail/SpamAssassin/CmdLearn.pm in @INC (@INC contains:
/usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/5.6.1/i386-freebsd
/usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
/usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl)

and the module is installed in
usr/local/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/CmdLearn.pm

Is there any reason other than it not being there that a Perl require call
may fail?

Many thanks

Justin Wyllie

Justin,

Any reason you are using a 'require' instead of 'use'? I think 'use'
would probably solve your problem.

Otherwise, from looking at the error message, it looks like it may be a
path problem.

It says INC contains '/usr/local/lib/perl5/site_perl/5.6.1'. But, it is
trying to require 'Mail/SpamAssassin/CmdLearn.pm'. There is a missing /
between the library path and the module.

(It is looking for
'/usr/local/lib/perl5/site_perl/5.6.1Mail/SpamAssassin/CmdLearn.pm',
which doesn't exist.)

- Ken
 
J

Justin Wyllie

Justin,

Any reason you are using a 'require' instead of 'use'? I think 'use'
would probably solve your problem.

Otherwise, from looking at the error message, it looks like it may be a
path problem.

It says INC contains '/usr/local/lib/perl5/site_perl/5.6.1'. But, it is
trying to require 'Mail/SpamAssassin/CmdLearn.pm'. There is a missing /
between the library path and the module.

(It is looking for
'/usr/local/lib/perl5/site_perl/5.6.1Mail/SpamAssassin/CmdLearn.pm',
which doesn't exist.)

- Ken

Hi Ken

Thanks for your reply. In fact after a bit more fiddling about I found the
problem was that the paths in my @INC are all relavtive to my chrooted jail
and I needed to put the full system path into @INC. Thanks for the
encouragement though

Justin
 
J

Jay Tilton

: Justin Wyllie wrote:
: > I'm running a program sa-learn that comes with SpamAssassin anti-spam s/w.
: >
: > This script fails on this line:
: >
: > require Mail::SpamAssassin::CmdLearn;
: >
: > with a message saying the module can't be found in @INC. The print-out for
: > @INC includes:
:
: Any reason you are using a 'require' instead of 'use'? I think 'use'
: would probably solve your problem.

What misapprehension causes you to believe "use" can locate a file that
"require" cannot?
 
A

Anno Siegel

Ken said:
Justin,

Any reason you are using a 'require' instead of 'use'? I think 'use'
would probably solve your problem.

I'd expect "use" to report exactly the same error as "require".
Otherwise, from looking at the error message, it looks like it may be a
path problem.

It says INC contains '/usr/local/lib/perl5/site_perl/5.6.1'. But, it is
trying to require 'Mail/SpamAssassin/CmdLearn.pm'. There is a missing /
between the library path and the module.

(It is looking for
'/usr/local/lib/perl5/site_perl/5.6.1Mail/SpamAssassin/CmdLearn.pm',
which doesn't exist.)

This is just wrong. It is looking for .../5.6.1/Mail/... . Please don't
post mere speculation.

Anno
 
P

Peter Pan

Anno said:
I'd expect "use" to report exactly the same error as "require".




This is just wrong. It is looking for .../5.6.1/Mail/... . Please don't
post mere speculation.

Anno

How about trying to copy CmdLearn.pm into .../5.6.1 dir and try use CmDLearn, just to see if it works and then continue dir by dir ?

PP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top