[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: __DIE__ and exception hooks



"Redford, John" wrote:

> What would that mean for my currently running code:
>         die [ 1, 2 ];

Good question. *Excellent* question...

Hmmm.

Five things can be passed into C<die>:

1. text
Package into an Exception::Basic object.

2. nowt
Propagate if $@, else raise Exception::Basic 'Died'.

3. blessed ref that isa(Exception)
Process as is.

4. unblessed reference
Bless into an Exception::User object. Maybe. If you're doing
C<if (ref $@ eq 'ARRAY')> we're stuffed.

5. blessed non-Exception object
If die gets a non-Exception blessed reference, we can't create an object
inheriting from it and Exception as code may well be checking for its
class name without using isa, so I suppose all we can do is coerce
Exception into its inheritance tree and hope for the best...

I wonder how much code there is out there that would be affected by 4.
or 5.

Pete
-- 
use Disclaimer::Standard;
my $phone='+44 1793 564450';    # "THIS IS THE COMPATIBILITY
my $fax='+44 1793 566918';      #  POLICE. RESTORE YOUR ORIGINAL
my $mobile='+44 7973 725120';   #  TOKE.C AND BACK AWAY SLOWLY."


Follow-Ups from:
Larry Wall <larry@wall.org>
References to:
"Redford, John" <John.Redford@fmr.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]