Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: forked die() in eval block has counterintuitive behavior?

by rlucas (Scribe)
on May 24, 2005 at 01:31 UTC ( [id://459771]=note: print w/replies, xml ) Need Help??


in reply to Re: forked die() in eval block has counterintuitive behavior?
in thread forked die() in eval block has counterintuitive behavior?

Yes. I misspoke; as the PIDs clearly show (and as my intention in including them was to indicate), the "catch" of the die() is in the child process.

An unexpected child die() gets caught by a containing eval block that thinks it's just dealing with the parent.

The overall problem, then, is as you state -- not knowing that a fork() has happened. Is there a general way, then, to deal with this in evals? It seems that the casualness with which fork()s are issued in various places makes this problem endemic to the idiom of Perl...

  • Comment on Re^2: forked die() in eval block has counterintuitive behavior?

Replies are listed 'Best First'.
Re^3: forked die() in eval block has counterintuitive behavior?
by samtregar (Abbot) on May 24, 2005 at 02:18 UTC
    An unexpected child die() gets caught by a containing eval block that thinks it's just dealing with the parent.

    I don't think this problem is specific to eval{}. Any code which is going to fork needs to be careful about which code is going to run in the parent and which in the child. It's just a fact of Unix programming, not really a problem with Perl specifically.

    -sam

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found