Subject: | File::Spec->rel2abs() incorrect inside a symlinked dir. |
I've been noticing things failing on OS X because paths are in
/private/var rather than /var. My CPAN build directory is inside /var.
/var is really a symlink to /private/var, this is a normal OS X thing.
When in /var, File::Spec->rel2abs() will use /private/var as its base,
cwd() will use /var/local and getcwd() will report /private/var.
$ perl -wle 'use Cwd; print getcwd'
/private/var/local
$ perl -wle 'use Cwd; print cwd'
/var/local
$ perl -wle 'use File::Spec; print File::Spec->rel2abs(".")'
/private/var/local
This is because getcwd() walks up the directory tree while cwd() will
look at $PWD.
The File::Spec->rel2abs docs state:
If $base is not present or '', then Cwd::cwd() is used.
But the code uses getcwd().