From: Cory Watson Date: Thu, 25 Jun 2009 19:30:34 +0000 (-0500) Subject: Make inline_slot_access use double quotes to be consistent (found by X-Git-Tag: 0.89~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5fb4edd5750aadf2d20fdf45e95149272d48343a;p=gitmo%2FClass-MOP.git Make inline_slot_access use double quotes to be consistent (found by me, blessed by Sartak) --- diff --git a/Changes b/Changes index c54e94c..1252e51 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for Perl extension Class-MOP. 0.89 * Class::MOP::Instance - add inline version of rebless_instance_structure. (doy) + - change inline_slot_access to use single quotes (gphat) 0.88 Tue, Jun 23, 2009 * Class::MOP::Class diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index 6d25443..56d9a30 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -177,7 +177,7 @@ sub inline_create_instance { sub inline_slot_access { my ($self, $instance, $slot_name) = @_; - sprintf q[%s->{"%s"}], $instance, quotemeta($slot_name); + sprintf q[%s->{'%s'}], $instance, quotemeta($slot_name); } sub inline_get_slot_value { diff --git a/t/061_instance_inline.t b/t/061_instance_inline.t index 9e2e265..3856bfe 100644 --- a/t/061_instance_inline.t +++ b/t/061_instance_inline.t @@ -18,11 +18,11 @@ my $C = 'Class::MOP::Instance'; 'bless {} => $class', '... got the right code for create_instance'); is($C->inline_get_slot_value($instance, $slot_name), - '$self->{"foo"}', + "\$self->{'foo'}", '... got the right code for get_slot_value'); is($C->inline_set_slot_value($instance, $slot_name, $value), - '$self->{"foo"} = $value', + "\$self->{'foo'} = \$value", '... got the right code for set_slot_value'); is($C->inline_initialize_slot($instance, $slot_name), @@ -30,18 +30,18 @@ my $C = 'Class::MOP::Instance'; '... got the right code for initialize_slot'); is($C->inline_is_slot_initialized($instance, $slot_name), - 'exists $self->{"foo"}', + "exists \$self->{'foo'}", '... got the right code for get_slot_value'); is($C->inline_weaken_slot_value($instance, $slot_name), - 'Scalar::Util::weaken( $self->{"foo"} )', + "Scalar::Util::weaken( \$self->{'foo'} )", '... got the right code for weaken_slot_value'); is($C->inline_strengthen_slot_value($instance, $slot_name), - '$self->{"foo"} = $self->{"foo"}', + "\$self->{'foo'} = \$self->{'foo'}", '... got the right code for strengthen_slot_value'); is($C->inline_rebless_instance_structure($instance, $class), - 'bless $self => $class', + "bless \$self => \$class", '... got the right code for rebless_instance_structure'); }