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

Hi,

I am trying to run my perl script on a super computer. This script uses a module I made. Everything is working fine when I run it directly on a node, but when I submit my script with qsub, I get the : Can't locate mymodule.pm in @INC error

The node where I run it directly and the node where I submit my script are the same. Same modules loaded, ect. I don't understand where could be the problem. Any idea?

Thank you very much

Replies are listed 'Best First'.
Re: Exporter and qsub
by ikegami (Patriarch) on Sep 12, 2011 at 22:14 UTC

    I presume the module is simply located in the same directory as the script rather than being "installed"?

    Perl will usually look into the current directory (but not when using -T), but the current directory is not necessarily the one in which the script is located. Adding the following to your script should tell Perl where to look:

    use Cwd qw( realpath ); use File::Basename qw( dirname ); use lib dirname(realpath($0));
Re: Exporter and qsub
by Anonymous Monk on Sep 12, 2011 at 21:48 UTC

    What is in @INC (the tail output of perl -V)?

    And how does it compare when run from qsub print qx{$^X -V}?

      Hi, Thanks for your reply, and sorry, but what does print qx{$^X -V} is supposed to do? I cannot run it... :/

        Its perl -V from within your program (or qsub)

        In anycase, its all about @INC

Re: Exporter and qsub
by Anonymous Monk on Sep 13, 2011 at 03:06 UTC

    Hi,

    Try printing your %ENV and @INC in both ways to make sure they are the same.

    J.C.

      Yeah! It is working :) . (adding the  use lib ... to tell him where to look at - thxs ikegami-, and also I was running it from the wrong dir without realizing).

      Thank you so much for your advices