> Dan Muey wrote:
>
> [snip]
>
> > $SIG{__WARN__} = ''; # or is undef or delete better??
> $SIG{__DIE__} =
> > ''; # or is undef or delete better??
> >
> > That works like a charm but it does not work with $SIG{__DIE__} for
> > some reason. It still just croaks as usual. Any ideas?
> >
>
> there are at least a couple of ways of doing that:
>
> #!/usr/bin/perl -w
> use strict;
>
> BEGIN{
> use subs qw(Carp::die);
> use vars qw($e);
> sub Carp::die{ $e = "Carp::die: @_" }
> }
>
> use Carp;
>
> croak "croaking";
>
> print "after croak \$e is: $e";
>
> __END__
>
> prints:
>
> after croak $e is: Carp::die: croaking at x.pl line 10
>
> another way to accomplish the same thing:
>
> #!/usr/bin/perl -w
> use strict;
>
> BEGIN{
>
> our $e;
>
> *CORE::GLOBAL::die = sub{
> $e = "CORE:GLOBAL::die => @_";
> };
> }
>
> use Carp;
>
> use vars qw($e);
>
> croak "croaking";
>
> print "after croak \$e is: $e";
>
> __END__
>
> prints:
>
> after croak $e is: CORE:GLOBAL::die => croaking at x.pl line 10
>
> i don't have time to check out the source of Carp.pm but if
> you do, i would
> suggest you go take a look as there might be a better
> solution to it. out
> of the 2 methods i described, the second one is more natural, imo.
>
Cool, I was wondering about if that was possible, overriding the function.
I'll try that out a bit and see how iut can fit into my scheme.
Thanks david!
> david
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>