We only need local $? if we inline calls to DEMOLISH
[gitmo/Moose.git] / lib / Moose / Meta / Method / Destructor.pm
index 810fa70..e06a13d 100644 (file)
@@ -8,10 +8,6 @@ use Devel::GlobalDestruction ();
 use Scalar::Util 'blessed', 'weaken';
 use Try::Tiny;
 
-our $VERSION   = '1.19';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
 use base 'Moose::Meta::Method',
          'Class::MOP::Method::Inlined';
 
@@ -32,6 +28,7 @@ sub new {
         'name'                 => $options{name},
         # ...
         'options'              => $options{options},
+        'definition_context'   => $options{definition_context},
         'associated_metaclass' => $options{metaclass},
     } => $class;
 
@@ -85,6 +82,7 @@ sub _initialize_body {
             'return ' . $self->_generate_fallback_destructor('$self'),
                 'if Scalar::Util::blessed($self) ne \'' . $class . '\';',
             $self->_generate_DEMOLISHALL('$self'),
+            'return;',
         '}',
     );
     warn join("\n", @source) if $self->options->{debug};
@@ -125,36 +123,32 @@ sub _generate_DEMOLISHALL {
             (map { $inv . '->' . $_->{class} . '::DEMOLISH($igd);' } @methods),
         '}',
         'Try::Tiny::catch {',
-            'no warnings \'misc\';',
             'die $_;',
         '};',
-        'return;',
     );
 }
 
 
 1;
 
+# ABSTRACT: Method Meta Object for destructors
+
 __END__
 
 =pod
 
-=head1 NAME
-
-Moose::Meta::Method::Destructor - Method Meta Object for destructors
-
 =head1 DESCRIPTION
 
-This class is a subclass of L<Class::MOP::Class::Generated> that
+This class is a subclass of L<Class::MOP::Method::Inlined> that
 provides Moose-specific functionality for inlining destructors.
 
 To understand this class, you should read the the
-L<Class::MOP::Class::Generated> documentation as well.
+L<Class::MOP::Method::Inlined> documentation as well.
 
 =head1 INHERITANCE
 
 C<Moose::Meta::Method::Destructor> is a subclass of
-L<Moose::Meta::Method> I<and> L<Class::MOP::Method::Generated>.
+L<Moose::Meta::Method> I<and> L<Class::MOP::Method::Inlined>.
 
 =head1 METHODS
 
@@ -195,18 +189,5 @@ of its parents defines a C<DEMOLISH> method, it needs a destructor.
 
 See L<Moose/BUGS> for details on reporting bugs.
 
-=head1 AUTHORS
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2006-2010 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
 =cut