Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Checking success of open() on file held in scalar ref.

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;.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://650804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found