From: Dave Rolsky Date: Fri, 20 Feb 2009 20:11:05 +0000 (+0000) Subject: Changes to work with 0.78 meta-instance code, which no longer expects X-Git-Tag: 0.71_01~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eae37c67268fb05d0f2bc5473c38710a4a726f11;p=gitmo%2FMoose.git Changes to work with 0.78 meta-instance code, which no longer expects a quoted attr name when inlning attr access. --- diff --git a/Makefile.PL b/Makefile.PL index 5106e15..9c6ac7b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,7 +12,7 @@ license 'perl'; requires 'Scalar::Util' => '1.19'; requires 'Carp'; -requires 'Class::MOP' => '0.77'; +requires 'Class::MOP' => '0.78'; requires 'List::MoreUtils' => '0.12'; requires 'Sub::Exporter' => '0.972'; requires 'Task::Weaken' => '0'; diff --git a/lib/Moose.pm b/lib/Moose.pm index 6514a6b..cdd3cca 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -15,7 +15,7 @@ use Carp 'confess'; use Moose::Exporter; -use Class::MOP 0.77; +use Class::MOP 0.78; use Moose::Meta::Class; use Moose::Meta::TypeConstraint; diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index de6dbd7..9eba83b 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -217,10 +217,9 @@ sub _inline_store { my $attr = $self->associated_attribute; my $mi = $attr->associated_class->get_meta_instance; - my $slot_name = sprintf "'%s'", $attr->slots; - my $code = $mi->inline_set_slot_value($instance, $slot_name, $value) . ";"; - $code .= $mi->inline_weaken_slot_value($instance, $slot_name, $value) . ";" + my $code = $mi->inline_set_slot_value($instance, $attr->slots, $value) . ";"; + $code .= $mi->inline_weaken_slot_value($instance, $attr->slots, $value) . ";" if $attr->is_weak_ref; return $code; } @@ -237,9 +236,8 @@ sub _inline_get { my $attr = $self->associated_attribute; my $mi = $attr->associated_class->get_meta_instance; - my $slot_name = sprintf "'%s'", $attr->slots; - return $mi->inline_get_slot_value($instance, $slot_name); + return $mi->inline_get_slot_value($instance, $attr->slots); } sub _inline_access { @@ -247,9 +245,8 @@ sub _inline_access { my $attr = $self->associated_attribute; my $mi = $attr->associated_class->get_meta_instance; - my $slot_name = sprintf "'%s'", $attr->slots; - return $mi->inline_slot_access($instance, $slot_name); + return $mi->inline_slot_access($instance, $attr->slots); } sub _inline_has { @@ -257,9 +254,8 @@ sub _inline_has { my $attr = $self->associated_attribute; my $mi = $attr->associated_class->get_meta_instance; - my $slot_name = sprintf "'%s'", $attr->slots; - return $mi->inline_is_slot_initialized($instance, $slot_name); + return $mi->inline_is_slot_initialized($instance, $attr->slots); } sub _inline_auto_deref { diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index 4679dc9..98e419b 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -221,7 +221,7 @@ sub _generate_triggers { . '$instance, ' . $self->meta_instance->inline_get_slot_value( '$instance', - ("'" . $attr->name . "'") + $attr->name, ) . ', ' . '$attrs->[' . $i . ']' @@ -319,7 +319,7 @@ sub _generate_slot_assignment { $source = ( $self->meta_instance->inline_set_slot_value( '$instance', - ("'" . $attr->name . "'"), + $attr->name, $value ) . ';' ); @@ -332,7 +332,7 @@ sub _generate_slot_assignment { "\n" . $self->meta_instance->inline_weaken_slot_value( '$instance', - ("'" . $attr->name . "'") + $attr->name ) . ' if ref ' . $value . ';' );