methods. This has been removed. You must be explicit in your handles
declaration for all Native Traits. (Dave Rolsky)
+ * Moose::Object
+ - DEMOLISH now localizes all of Perl's global status variables (worst
+ Perl feature evah?). Based on a patch from zefream. RT #48271. (doy
+ and Dave Rolsky)
+
0.89_02 Thu, Sep 10, 2009
* Moose::Meta::Attribute::Native
- Fix Hash, which still had 'empty' instead of 'is_empty'. (hdp)
}
sub DESTROY {
- # if we have an exception here ...
- if ($@) {
- # localize the $@ ...
- local $@;
- # run DEMOLISHALL ourselves, ...
- $_[0]->DEMOLISHALL(in_global_destruction);
- # and return ...
- return;
- }
- # otherwise it is normal destruction
+ local ( $., $@, $!, $^E, $? );
$_[0]->DEMOLISHALL(in_global_destruction);
+ return;
}
# support for UNIVERSAL::DOES ...
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 7;
use Test::Exception;
like( $@, qr/Bar died/, "... Bar plain" );
is( $obj, undef, "... the object is undef" );
}
+
+{
+ package Baz;
+ use Moose;
+
+ sub DEMOLISH {
+ $@ = 1;
+ $? = 0;
+ $! = 0;
+ }
+}
+
+{
+ local $@ = 0;
+ local $? = 42;
+ local $! = 84;
+
+ {
+ Baz->new;
+ }
+
+ is( $@, 0, '$@ is still 0 after object is demolished' );
+ is( $?, 42, '$? is still 42 after object is demolished' );
+ is( $! + 0, 84, '$! is still 84 after object is demolished' );
+}
+