$ cat .Huh.
cat: .: Is a directory
$ perl -pe '' .
Turns out you can open(2) a directory just fine, so Perl doesn't bat an eye over that. It's only the subsequent read(2) that will fail, indicated by readline (or read, or sysread) returning undef, which you're supposed to check for. Yeah, like anyone actually checks for these things.
The worst part is that autodie won't save your ass in this situation:
use autodie;Apparently, not much can be done about this. :(
use warnings;
open FH, "<", ".";
1 while <FH>;
close FH;
print "Uncaught: $!\n";
No comments:
Post a Comment