Symbolic links and file tests in perl

Brian Dessent brian@dessent.net
Tue Apr 15 06:05:00 GMT 2008


Scott Webster Wood wrote:

> I tried doing a if(-l $file) where $file was the name of a symbolically linked directory in the current working directory and it returned a false.  Doing a (-d $file) returned true.

I can't reproduce this:

$ mkdir foo; ln -s foo bar

$ perl -e 'print "yes\n" if (-l "bar");'
yes

Please provide a testcase that demonstrates the problem.

> Is there any way to work around this and then retrieve the real path of a symbolically linked directory under cygwin?

$ perl -e 'print readlink("bar")'
foo

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list