Make mouse_accessor_get_self() "static inline"
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index 38d3153..ae69e32 100644 (file)
@@ -3,16 +3,14 @@ use Mouse::Util qw/:meta get_linear_isa not_supported/; # enables strict and war
 
 use Scalar::Util qw/blessed weaken/;
 
-use Mouse::Meta::Method::Constructor;
-use Mouse::Meta::Method::Destructor;
 use Mouse::Meta::Module;
 our @ISA = qw(Mouse::Meta::Module);
 
 sub method_metaclass()    { 'Mouse::Meta::Method'    }
 sub attribute_metaclass() { 'Mouse::Meta::Attribute' }
 
-sub constructor_class()   { 'Mouse::Meta::Method::Constructor' }
-sub destructor_class()    { 'Mouse::Meta::Method::Destructor'  }
+sub constructor_class();
+sub destructor_class();
 
 sub _construct_meta {
     my($class, %args) = @_;
@@ -191,7 +189,7 @@ sub clone_instance {
 sub make_immutable {
     my $self = shift;
     my %args = (
-        inline_constructor => 0,
+        inline_constructor => 1,
         inline_destructor  => 1,
         constructor_name   => 'new',
         @_,
@@ -200,13 +198,17 @@ sub make_immutable {
     $self->{is_immutable}++;
 
     if ($args{inline_constructor}) {
+        my $c = $self->constructor_class;
+        Mouse::Util::load_class($c);
         $self->add_method($args{constructor_name} =>
-            $self->constructor_class->_generate_constructor($self, \%args));
+            $c->_generate_constructor($self, \%args));
     }
 
     if ($args{inline_destructor}) {
+        my $c = $self->destructor_class;
+        Mouse::Util::load_class($c);
         $self->add_method(DESTROY =>
-            $self->destructor_class->_generate_destructor($self, \%args));
+            $c->_generate_destructor($self, \%args));
     }
 
     # Moose's make_immutable returns true allowing calling code to skip setting an explicit true value
@@ -408,7 +410,7 @@ Mouse::Meta::Class - The Mouse class metaclass
 
 =head1 VERSION
 
-This document describes Mouse version 0.40_05
+This document describes Mouse version 0.40_06
 
 =head1 METHODS