Skip Menu |
 

This queue is for tickets about the Object-InsideOut CPAN distribution.

Report information
The Basics
Id: 20721
Status: resolved
Worked: 4 hours (240 min)
Priority: 0/
Queue: Object-InsideOut

People
Owner: jdhedden [...] cpan.org
Requestors: STATHY [...] stathy.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.42
Fixed in: 1.46



Subject: Bug catching exception during initialization with defined destroy method
Perl version v5.8.8 built for MSWin32-x86-multi-thread WinXP Pro 2002 sp2 This issue happens when an exception is thrown inside the initialization method. When a defined destroy method is in the same class which may include an eval statement or call to outside code that contains an eval statement the original exception thrown from the initialization method fails silently. If destroy should always be called even in the event of an exception perhaps $@ should be retained before and after destroy. ################################# package MyTest; { use strict; use warnings; use lib qw( ./lib/site/ ./lib/ ); use Object::InsideOut; sub init :INIT { die "TEST"; my $this = shift; } sub destroy :DESTROY { # Remove line below to allow init exception to be caught. # return if $@; my $this = shift; eval { "In Destroy" }; } } my $etl = eval { MyTest->new() }; if (my $e = Exception::Class->caught()) { print "Caught Error!"; } 1;
Download (untitled) / with headers
text/plain 154b
This error is not OIO specific, but can be reproduced using ordinary objects. However, I came up with a fix, and have posted it (v1.46) to CPAN. Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.