Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Can't locate Modules/test.pm in @INC

by techcode (Hermit)
on Feb 23, 2007 at 00:06 UTC ( [id://601663]=note: print w/replies, xml ) Need Help??


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

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.
  • Comment on Re^2: Can't locate Modules/test.pm in @INC

Replies are listed 'Best First'.
Re^3: Can't locate Modules/test.pm in @INC
by Joost (Canon) on Feb 23, 2007 at 00:40 UTC
      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.
        Huh. that page is wrong. :-) At least it doesn't work like that if you run a script from the command line / shell script. Running from a shell does not change the cwd, because that would defeat the point of having a cwd in the first place.

        Some other environments do set the cwd; usually to the scrip's install dir, but that's normally because there isn't a logical cwd to begin with (i.e. in a CGI environment, or on windows, if you start a script by clicking on its icon)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-16 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found