Do you know where your variables are? | |
PerlMonks |
DESTROY handler changes child exit status?by saintmike (Vicar) |
on May 09, 2013 at 07:04 UTC ( [id://1032733]=perlquestion: print w/replies, xml ) | Need Help?? |
saintmike has asked for the wisdom of the Perl Monks concerning the following question:
I was surprised to find that a DESTROY handler called when an object goes out of scope changes the exit status of the child process it's running in, even if that child exits with exit(exit_code).
This code:
shows pid=4778 status: 255although the child exits with exit(5). So the failing system() call in the DESTROY method of the object that goes out of scope overrides the explicitly set exit() value? (If you comment out the system() call in the DESTROY handler and uncomment the one in the child code you'll get the expected exit code 5). Surprised?
Back to
Seekers of Perl Wisdom
|
|