Perl alternative to Cwd::abs_path for symbolic links
My Perl app receives relative paths to files and arguments and then converts them to absolute paths. I had been using Cwd::开发者_开发百科abs_path($fileName)
just fine, but now I need to support symbolic links and I find that abs_path will give me the absolute path to the original file.
What I need is an alternative to Cwd::abs_path
that when given a relative path to a symlink will convert it to an absolute path to that same symlink. Any recommendations?
Example:
/originals/myfile1
/links/myfile1link -> /originals/myfile1
> cd /links
> perl converter.pl /myfile1link
> output: /links/myfile1link
File::Spec->rel2abs
does not do any system checks, so it won't resolve symlinks.
精彩评论