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

  • Follow


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


0
Reply Justin 1/3/2005 6:39:41 PM

Justin Wyllie wrote:
> 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

0
Reply Ken 1/3/2005 7:59:58 PM



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


0
Reply Justin 1/3/2005 9:39:31 PM

Ken <x3v0-usenet@yahoo.com> wrote:

: 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?

0
Reply tiltonj 1/5/2005 4:25:01 AM

Ken  <x3v0-usenet@yahoo.com> wrote in comp.lang.perl.misc:
> Justin Wyllie wrote:
> > 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.

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
0
Reply anno4000 1/5/2005 6:51:04 PM

Anno Siegel wrote:
> Ken  <x3v0-usenet@yahoo.com> wrote in comp.lang.perl.misc:
> 
>>Justin Wyllie wrote:
>>
>>>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.
> 
> 
> 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

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
0
Reply Peter 1/11/2005 10:34:19 AM

5 Replies
185 Views

(page loaded in 0.12 seconds)

Similiar Articles:













7/25/2012 11:49:41 PM


Reply: