in reply to Re: How to get a true canonical path
in thread How to get a true canonical path

Yeh - that figures out links pretty well..

use strict; use Cwd 'abs_path'; my $fileinquestion = "/var/mail/"; my $realpathfor = abs_path($fileinquestion); print "$realpathfor\n";


If you have to be out inside a system operation, the value of
pwd -P
is pretty real

Out of curiosity I tried a .. operation under win2k with AS.. it seems to work..
#!perl use strict; use Cwd; use Cwd 'abs_path'; my $q = 'C:\\TEMP\\'; chdir $q; my $dirnow = getcwd(); print "Changed dir to C:\\TEMP\n"; print "Cwd thinks I am in $dirnow\n"; chdir "..\\"; print "Changed dir up one level ..\n"; my $newdirnow = getcwd(); print "Cwd now thinks I am in $newdirnow\n";

so that might do the right thing if a user provides input including \path\..\another\path, so long as backslashes get treated correctly