Skip Menu |

This queue is for tickets about the Error CPAN distribution.

Report information
The Basics
Id: 7172
Status: resolved
Priority: 0/
Queue: Error

People
Owner: SHLOMIF [...] cpan.org
Requestors: nothingmuch [...] woobling.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: have throw and with use record internally
Recently I subclassed Error to do funny stuff when recording. This lets me subclass only record, and have throw/with work as expected.
--- Error.pm~ 2004-07-29 15:55:15.000000000 +0300 +++ Error.pm 2004-07-29 15:59:53.000000000 +0300 @@ -142,11 +142,11 @@ sub throw { my $self = shift; - local $Error::Depth = $Error::Depth + 1; # if we are not rethrow-ing then create the object to throw - $self = $self->new(@_) unless ref($self); - + # and always record $self in $Error::Depth + $self = $self->record(@_); + die $Error::THROWN = $self; } @@ -156,9 +156,8 @@ sub with { my $self = shift; - local $Error::Depth = $Error::Depth + 1; - $self->new(@_); + $self->record(@_); } # syntactic sugar for @@ -169,7 +168,7 @@ my $self = shift; local $Error::Depth = $Error::Depth + 1; - $self->new(@_); + ref $self ? $self : $self->new(@_); } # catch clause for
[guest - Thu Jul 29 08:01:20 2004]: Show quoted text
> Recently I subclassed Error to do funny stuff when recording. This > lets me subclass only record, and have throw/with work as expected.
Uh, i'm an idiot. the lines playing with $Error::Depth shouldn't be deleted.
This issue should be closed per request of the submitter (catched him on the IRC).