[Moose-commits] r7851 - in
MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute:
Meta/Method Role/Meta
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Fri Mar 13 18:08:55 GMT 2009
Author: autarch
Date: 2009-03-13 11:08:54 -0700 (Fri, 13 Mar 2009)
New Revision: 7851
Modified:
MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Meta/Method/Accessor.pm
MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Role/Meta/Class.pm
Log:
pass bare names and quote them closer to the code generation
Modified: MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Meta/Method/Accessor.pm
===================================================================
--- MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Meta/Method/Accessor.pm 2009-03-12 20:04:42 UTC (rev 7850)
+++ MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Meta/Method/Accessor.pm 2009-03-13 18:08:54 UTC (rev 7851)
@@ -11,11 +11,10 @@
sub generate_predicate_method_inline
{
my $attr = (shift)->associated_attribute;
- my $attr_name = $attr->name;
my $code =
eval 'sub {'
- . $attr->associated_class()->inline_is_class_slot_initialized( "'$attr_name'" )
+ . $attr->associated_class()->inline_is_class_slot_initialized( $attr->name() )
. '}';
confess "Could not generate inline predicate because : $@" if $@;
@@ -26,12 +25,11 @@
sub generate_clearer_method_inline
{
my $attr = (shift)->associated_attribute;
- my $attr_name = $attr->name;
my $meta_instance = $attr->associated_class->instance_metaclass;
my $code =
eval 'sub {'
- . $attr->associated_class()->inline_deinitialize_class_slot( "'$attr_name'" )
+ . $attr->associated_class()->inline_deinitialize_class_slot( $attr->name() )
. '}';
confess "Could not generate inline clearer because : $@" if $@;
@@ -47,12 +45,10 @@
my $attr = $self->associated_attribute();
- my $slot_name = sprintf "'%s'", $attr->slots();
-
my $meta = $attr->associated_class();
- my $code = $meta->inline_set_class_slot_value($slot_name, $value) . ";";
- $code .= $meta->inline_weaken_class_slot_value($slot_name, $value) . ";"
+ my $code = $meta->inline_set_class_slot_value( $attr->slots(), $value ) . ";";
+ $code .= $meta->inline_weaken_class_slot_value( $attr->slots(), $value ) . ";"
if $attr->is_weak_ref();
return $code;
@@ -65,9 +61,7 @@
my $attr = $self->associated_attribute;
my $meta = $attr->associated_class();
- my $slot_name = sprintf "'%s'", $attr->slots;
-
- return $meta->inline_get_class_slot_value($slot_name);
+ return $meta->inline_get_class_slot_value( $attr->slots() );
}
sub _inline_access
@@ -77,9 +71,7 @@
my $attr = $self->associated_attribute;
my $meta = $attr->associated_class();
- my $slot_name = sprintf "'%s'", $attr->slots;
-
- return $meta->inline_class_slot_access($slot_name);
+ return $meta->inline_class_slot_access( $attr->slots() );
}
sub _inline_has
@@ -89,9 +81,7 @@
my $attr = $self->associated_attribute;
my $meta = $attr->associated_class();
- my $slot_name = sprintf "'%s'", $attr->slots;
-
- return $meta->inline_is_class_slot_initialized($slot_name);
+ return $meta->inline_is_class_slot_initialized( $attr->slots() );
}
sub _inline_init_slot
Modified: MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Role/Meta/Class.pm
===================================================================
--- MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Role/Meta/Class.pm 2009-03-12 20:04:42 UTC (rev 7850)
+++ MooseX-ClassAttribute/trunk/lib/MooseX/ClassAttribute/Role/Meta/Class.pm 2009-03-13 18:08:54 UTC (rev 7851)
@@ -195,7 +195,7 @@
my $self = shift;
my $name = shift;
- return '$' . $self->_class_attribute_var_name . '{' . $name . '}';
+ return '$' . $self->_class_attribute_var_name . '{"' . quotemeta($name) . '"}';
}
sub inline_get_class_slot_value
More information about the Moose-commits
mailing list