Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Checking success of open() on file held in scalar ref.by jbert (Priest) |
on Nov 14, 2007 at 17:17 UTC ( [id://650804]=note: print w/replies, xml ) | Need Help?? |
The checking is always worth doing, imho.
Even if careful thought and analysis demonstrate that current versions of perl can't return an error, unless the docs give an explicit guarantee it won't fail I'd say that the behaviour is subject to change in future versions. (And said careful thought and analyis is more work than checking the error return anyway...) Maybe a future implementation of "open scalar" likes to have a dummy unix fd behind the scenes, to remove special cases in some codepaths and your process hit's it's limit? (Or other very hypothetical situations - who can come up with the most inventive?). Of course, if there were a significant benefit to dropping the error handling (or if you're in an environment where you don't care much), then fine. But that's true of anything, even exploiting explicitly undefined behaviour like my $foo if 0;.
In Section
Seekers of Perl Wisdom
|
|