Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
First off, these are from my experiences trying the same thing, they may not be the best answers, but they do work for me.

1. END block.

2. To make sure you still exit with the return value that got you into the END block, make sure to put local $?; at the beginning of your end block.

If you don't do this, the return value of the last thing you do in the end block will be the return value back to the caller of the script (which for me is Autosys and it was causing a script that should have been returning failure to return success because my last statement was a successful print to STDERR that my script was returning failure.

3. The way I accomplished this was in my parent to have a my $_PARENT_PID = $$; as a global variable. Then in the END block, you can check:

if( $$ == $_PARENT_PID ) { # parent } else { # child }

Like I said, not the best way, but it worked. Maybe someone else will have some better solutions.

best of luck...

In reply to Re: fork, %SIG, END. by etm117
in thread fork, %SIG, END. by eff_i_g

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2022-11-28 22:20 GMT
Find Nodes?
    Voting Booth?