From: Dave Rolsky Date: Thu, 4 Dec 2008 22:33:53 +0000 (+0000) Subject: Make inlined_constructor return an actual method, not just a X-Git-Tag: 0.71_02~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec845081066fd7944a963fbc1e63b5d42f609589;p=gitmo%2FClass-MOP.git Make inlined_constructor return an actual method, not just a boolean. This will make my Moose changes much simpler. --- diff --git a/lib/Class/MOP/Immutable.pm b/lib/Class/MOP/Immutable.pm index bde41f7..851cdaf 100644 --- a/lib/Class/MOP/Immutable.pm +++ b/lib/Class/MOP/Immutable.pm @@ -36,7 +36,7 @@ sub new { 'metaclass' => $metaclass, 'options' => $options, 'immutable_metaclass' => undef, - 'inlined_constructor' => 0, + 'inlined_constructor' => undef, ); return $self; @@ -159,7 +159,7 @@ sub _inline_constructor { if ( $options->{replace_constructor} or $constructor->can_be_inlined ) { $metaclass->add_method( $options->{constructor_name} => $constructor ); - $self->{inlined_constructor} = 1; + $self->{inlined_constructor} = $constructor; } } @@ -364,7 +364,7 @@ sub make_metaclass_mutable { if ( blessed($immutable->get_method($options{constructor_name})) eq $constructor_class ) { $immutable->remove_method( $options{constructor_name} ); - $self->{inlined_constructor} = 0; + $self->{inlined_constructor} = undef; } } } @@ -464,6 +464,9 @@ given to make_metaclass_immutable. =item B +If the constructor was inlined, this returns the constructor method +object that was created to do this. + =back =head1 AUTHORS