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

Replies are listed 'Best First'.
Re^4: file::find usage with apache question
by aaron_baugher (Curate) 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.

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