Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Perl version missmatch

by deadpickle (Pilgrim)
on Jul 09, 2009 at 00:26 UTC ( [id://778445]=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to run a perl script using crontab as root. When I run it I get this error:
Can't locate Mail/Box/Manager.pm in @INC (@INC contains: /usr/lib/perl +5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5. +8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux +-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi +/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/li +b/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5 +/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi / +usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl +5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_per +l/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr +/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/li +b/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5 +.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./has-downloa +d-0.1.pl line 3. BEGIN failed--compilation aborted at ./has-download-0.1.pl line 3.
and with this:
This is perl, v5.10.0 built for i686-linux
and searching for Manager.pm returns:
/usr/local/lib/perl5/site_perl/5.10.0/Mail/Box/Thread/Manager.pm
With all of this it is obvious that perl versions in @INC and where the module is do not compare. My question here is, how do I fix this?

Replies are listed 'Best First'.
Re: Perl version missmatch
by toolic (Bishop) on Jul 09, 2009 at 00:37 UTC
    Nothing to do with Perl version, but your script is looking for Mail/Box/Manager.pm, not Mail/Box/Thread/Manager.pm

    What does the shebang (#!) line look like in your ./has-download-0.1.pl script?

      Yah... that makes me feel like a fool.

      just below it /usr/local/lib/perl5/site_perl/5.10.0/Mail/Box/Manager.pm was returned.

      #!/usr/bin/perl -w

Re: Perl version missmatch
by derby (Abbot) on Jul 09, 2009 at 01:23 UTC

    To me it looks like you have two copies of perl on the box -- one at version 5.10 and one at 5.8. (your 'and with this' note is vague.). What does your cron line look like? Are you doing something like perl path-to-script? In that case, you may be picking up the wrong version of perl. Does it run fine as root but fails under root's cron? In that case, you have some environment variable being set (PERL5LIB) that is not visible under the minimal cron environment.

    -derby
      Sorry:
      [thor@updraft ~/Programs]$ perl -v This is perl, v5.10.0 built for i686-linux
      I tested two crontabs.
      1. has-download-0.1.pl: returned the same error above.
      2. perl has-download-0.1.pl: returned the same error above.

      This program runs fine just typing perl has-download-0.1.pl into a terminal. Not sure how to change the variable so that it is visible to cron.

      I also tried running the script in the background using:

      #!/bin/csh at now << EOF ./has-download-0.1.pl EOF exit
      and received this in my mail:
      Can't locate Mail/Box/Manager.pm in @INC
        Its definitely true that cron is using perl5.8.8 to execute my scripts. This is verified by the output:
        root@updraft thor]# perl5.8.8 -V @INC: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8
        Guess I'm going to have to do some research into why cron is using the old command perl5.8.8 and not the new one perl.
        Where is Perl 5.10 installed and where is 5.8.8 installed? Assuming that 5.10 is installed in /usr/bin/perl try this in the crontab file:
        /usr/bin/perl has-download-0.1.pl
Re: Perl version missmatch
by Anonymous Monk on Jul 09, 2009 at 00:33 UTC
    Try
    use lib '/usr/local/lib/perl5/site_perl/5.10.0/';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://778445]
Approved by AnomalousMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found