use local,like:
{ # in a code block
local $SIG{__DIE__} = sub { ....};
do something...
}
when code run out of the block,$SIG{__DIE__} will restore to its default value.
On 10/26/07, dolfantimmy <[EMAIL PROTECTED]> wrote:
> I need to use $SIG to modify the behavior of die in a portion of my
> code. The module I am calling uses die instead of returning a certain
> error, that I EXPECT to encounter. So, I can do this....
> $SIG{_ _DIE_ _} = sub {
> my $message = shift;
>
> print STDOUT "Script died with this message:\n";
> print STDOUT "$message\n";
> };
>
> However, I only want this modified behavior in one small section of
> the code. How do I return the behavior to it's default?
>
> Thanks
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/