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
In reply to Relative paths in included files by a,s5
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |