Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Resolving correct directory path in a symlinked directoryby beermad (Novice) |
on Apr 29, 2011 at 12:55 UTC ( [id://901973]=perlquestion: print w/replies, xml ) | Need Help?? |
beermad has asked for the wisdom of the Perl Monks concerning the following question: I need to re-use a common cgi-bin subdirectory for a number of websites I'm developing on my server. So the logical method would be:
which works perfectly, EXCEPT that in order to extract site-specific parameters, the cgi scripts need to read files in each individual site's own directory structure. But when resolving relative paths (I can't use absolute because of the nature of the eventual deployment environments) or even the current directory itself, my Perl scripts consider themselves to be in the original directory, not the one it SHOULD think it's in. To clarify:
Similarly, trying to open a file with a relative path from /www/site1/cgi-bin fails because Perl's trying to open it relative to /www/global/cgi-bin. So, is there a way to either resolve the "correct" path to the current directory in this situation, or at least to persuade it to open files with relative paths as I need? The problem seems to be as much related to the Linux filesystem as to Perl itself, as
Shows the contents of /www/global, not /www/site1. Thanks in advance for any suggestions.
Back to
Seekers of Perl Wisdom
|
|