use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.81';
+our $VERSION = '0.89_02';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
- 'Class::MOP::Method::Generated';
+ 'Class::MOP::Method::Inlined';
sub new {
my $class = shift;
my $source;
if ( @DEMOLISH_methods ) {
$source = 'sub {';
+ $source .= 'local ( $., $@, $!, $^E, $? );' . "\n";
my @DEMOLISH_calls;
foreach my $method (@DEMOLISH_methods) {
warn $source if $self->options->{debug};
- my $code = $self->_compile_code(
+ my ( $code, $e ) = $self->_compile_code(
environment => {},
code => $source,
- ) or $self->throw_error("Could not eval the destructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source);
+ );
+
+ $self->throw_error(
+ "Could not eval the destructor :\n\n$source\n\nbecause :\n\n$e",
+ error => $e, data => $source )
+ if $e;
$self->{'body'} = $code;
}