Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re:x2 if (open(FH, $path)) { ? (I got the resource acquisition blues)

by Ryszard (Priest)
on May 03, 2004 at 14:56 UTC ( [id://350031]=note: print w/replies, xml ) Need Help??


in reply to Re:x2 if (open(FH, $path)) { ? (I got the resource acquisition blues)
in thread if (open(FH, $path)) { ?

Yup, agreed, i would s/theoretical// as there is an actual risk, and it can happen...

To handle the negative case, one could include a die handler in the open statement to make sure everything is nice and graceful.

  • Comment on Re: Re:x2 if (open(FH, $path)) { ? (I got the resource acquisition blues)

Replies are listed 'Best First'.
Re: Re: Re:x2 if (open(FH, $path)) { ? (I got the resource acquisition blues)
by bkiahg (Pilgrim) on May 03, 2004 at 15:15 UTC
    If I add an if (open(FH, $path) or die "$!") { doesn't that kill the application?

    I still want it to print out the rest of the webpage.

    Update2: Nevermind.
      It kills more than the if statement; if open is failing but your application isn't dying, you must be in an eval or something.
        Your right, I was printing out part of a webpage before the or die and it doesn't print any errors. Just ends the application.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found