Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Think about Loose Coupling
 
PerlMonks  

Re^3: file::find usage with apache question

by Corion (Pope)
on May 08, 2012 at 13:43 UTC ( #969461=note: print w/ replies, xml ) Need Help??


in reply to Re^2: file::find usage with apache question
in thread file::find usage with apache question

Your approach assumes that the "current working directory" is predictable. It usually isn't, so using absolute path names eliminates one more point of guesswork when debugging a (new) server environment.


Comment on Re^3: file::find usage with apache question
Re^4: file::find usage with apache question
by Yoshiro (Novice) on May 08, 2012 at 16:11 UTC

    Thank you Aaron and Corion

    Aaron, I have tried at first 'myDir' without slashes but it didn't work. I realize now it was because my script was running from 'cgi-bin' so it was looking in '/cgi-bin/myDir'.

    Corion, a good observation, noted.

    Yoshiro

      well, if you are running this in a cgi script, another possibility would be using FindBin to avoid an absolute path.
      find(..., "$FindBin::Bin/../myDir");

        Thank you tinita,

        An idea worth considering.

        Yoshiro

Re^4: file::find usage with apache question
by aaron_baugher (Chaplain) on May 08, 2012 at 22:57 UTC

    Agreed, using an absolute pathname is best. The only time I'd use a relative one in a case like this were if I had already used chdir with an absolute path to switch to a particular directory that contained multiple subdirectories for different kinds of things; then I'd use relative paths to access those subdirectories.

    Aaron B.
    Available for small or large Perl jobs; see my home node.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2013-05-26 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (524 votes), past polls