From: Jesse Luehrs Date: Thu, 21 Oct 2010 06:44:18 +0000 (-0500) Subject: refactor this to use _eval_environment X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b921e6bd2e94a59c73f3c51ace65f4ed677778d;p=gitmo%2FClass-MOP.git refactor this to use _eval_environment --- diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index 56f38c5..687aed6 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -93,13 +93,16 @@ sub _generate_constructor_method { return sub { Class::MOP::Class->initialize(shift)->new_object(@_) } } -sub _generate_constructor_method_inline { +sub _eval_environment { my $self = shift; - my $defaults = [map { $_->default } @{ $self->_attributes }]; - my $close_over = { + return { '$defaults' => \$defaults, }; +} + +sub _generate_constructor_method_inline { + my $self = shift; my $meta = $self->associated_metaclass; @@ -121,10 +124,7 @@ sub _generate_constructor_method_inline { warn join("\n", @source) if $self->options->{debug}; my $code = try { - $self->_compile_code( - source => \@source, - environment => $close_over, - ); + $self->_compile_code(\@source); } catch { my $source = join("\n", @source);