[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
Re: [MacPerl-AnyPerl] Trapping exit and die
On Wed, 4 Aug 1999 10:39:41 -0500, jason.whitehead@natinst.com wrote:
>I was wondering if there is any way to trap the exit and die calls. I need to be
>able to take a script that is to be executed by Perl from C and make sure that
>any calls to exit or die are not called. Note, I need to be able to do this from
>C/C++ because I am running Perl scripts from an application written in C/C++.
>Does anyone know a simple way of solving this problem.
exit(): no luck. But die() is easy to trap using eval().
You'd better replace all accurences of exit() with die(). Uh... can you
overload exit()? I couldn't...
eval {
print "Here we go!\n";
die "Let's end this farce...";
print "We never get here!\n";
};
print "Let's pretend nothing happened...\n";
Bart.
==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org