a,s5 has asked for the wisdom of the Perl Monks concerning the following question:
I have a number of perl scripts that I use for data maintenance. I would like to build a web front end for them (in PHP, since the site I'm assisting with uses it exclusively). The perl scripts are stored in /basedir/perl and the admin pages are stored in /basedir/admin.
My question is this: does Perl have anything like the dirname() function in PHP, that, when used thusly, dirname(__FILE__);, will return the absolute path to the script, no matter where it is included from?
I have subdirectories of perl scripts that reference external files, and when I access them from PHP pages, the different working directory breaks it. I can't hardcode the paths, since it's a small component of a large project set up in a test directory. I also do not want to program in paths relative to the including pages, as I want the files to be still useful from the commandline.
I have tried using Cwd and Config::Find::Where. The latter works somewhat, but only on the outermost level: if I try to access a perl script that includes another one in another folder, Config::Find::Where cannot grok the path for that internal file.
Is there an obvious solution to this that I am missing?
Thanks a bundle,
Andy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Relative paths in included files
by BUU (Prior) on Jun 04, 2004 at 23:17 UTC | |
by a,s5 (Initiate) on Jun 05, 2004 at 02:33 UTC | |
by a,s5 (Initiate) on Jun 05, 2004 at 03:22 UTC | |
|
Re: Relative paths in included files
by kragen (Sexton) on Jun 05, 2004 at 00:04 UTC | |
|
Re: Relative paths in included files
by PodMaster (Abbot) on Jun 05, 2004 at 06:41 UTC | |
by a,s5 (Initiate) on Jun 07, 2004 at 00:32 UTC |