in reply to Can't locate Modules/test.pm in @INC

Anyway, you're doing the PUSH at runtime, so the use line gets done first. Put it in a BEGIN {} block if you want, or use 'use lib "."'.
  • Comment on Re: Can't locate Modules/test.pm in @INC

Replies are listed 'Best First'.
Re^2: Can't locate Modules/test.pm in @INC
by techcode (Hermit) on Feb 23, 2007 at 00:06 UTC
    I experienced a similar problem today.

    For some reason the current working directory wasn't being set to the location where the script is running. It was manifested by the "can't load module ...", "can't call method XYC" ... Templates, config files .... whatever ... everything was coded with relative paths.

    Simplest solution was to set the CWD with :
    cwd '/full/path/here';

    Does anyone know what went wrong - so that CWD isn't automaticly set to location where the script is located?


    Have you tried freelancing? Check out Scriptlance - I work there. For more info about Scriptlance and freelancing in general check out my home node.
        Wow - I guess you learn something new each day.

        Beside being able to swear that I read somewhere that cwd is automaticly set to location where script is running. I never had an problem with that in the past ~ 5 years of working with Perl.

        Here is the source Changing the Working Directory which I found out yesterday - but I got it from other places in the past ...

        EDIT:

        During development and testing I used -T option. First thought was that it's the thing causing the problem on the server - obviosly it isn't.


        Have you tried freelancing? Check out Scriptlance - I work there. For more info about Scriptlance and freelancing in general check out my home node.