Closed p5pRT closed 16 years ago
The documentation for "-X" states that:
"Unless otherwise documented\, it returns 1 for true and '' for false\, or the undefined value if the file doesn't exist."
The -e operator does not return '' if the argument exists but is a symbolic link.
How to verify:
% ln -s x y % perl -MData::Dumper -e 'print Dumper([ -l "y"\, -e "y" ])' $VAR1 = [ 1\, undef ];
The second list entry should have been ''\, if the documentation had been correct. Or perhaps the implementation is incorrect?
2008/9/12 Gunnar.xa.Strand@ericsson.com (via RT) \perlbug\-followup@​perl\.org:
The documentation for "-X" states that:
"Unless otherwise documented\, it returns 1 for true and '' for false\, or the undefined value if the file doesn't exist."
The -e operator does not return '' if the argument exists but is a symbolic link.
That's actually correct. The -X operators do a stat\, not a lstat : thus\, they follow symbolic links\, and are actually testing x\, not y. You should use lstat instead.
$ perl -le 'lstat"y";print -l _\, -e _' 11
The RT System itself - Status changed from 'new' to 'open'
module@renee-baecker.de - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#58782 (status was 'resolved')
Searchable as RT58782$