good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: Find the full path of the script at run timeby mojotoad (Monsignor) |
on Mar 13, 2003 at 00:19 UTC ( [id://242551]=note: print w/replies, xml ) | Need Help?? |
Note my update above regarding rel2abs() from File::Spec.
In this case, however, you are bumping into the difference between abs_path() and fast_abs_path(): both generate cannonical paths, but the first relies on the OS by repeatedly issuing chdir() on path fragments in order to verify that Cwd and the OS are in agreement. This will cause problems if the path in question is hypothetical or if you do not have permission to traverse the path tree. fast_abs_path(), on the other hand, does this "visually" without checking with the OS -- as a consequence it's much faster, but potentially more risky. 99% of the time this is not a problem for most paths. If your paths have a tendency to utilize soft links that cross volumes and mount points (therefore potentially different filesystem types), then it can be a problem. Since Windows doesn't have soft links (shortcuts aren't soft links) then you shouldn't have a problem using fast_abs_path(). Wrote a song about it once. Like to see it? Here it is. Matt
In Section
Seekers of Perl Wisdom
|
|