From: Shawn M Moore Date: Fri, 15 Jun 2012 19:06:50 +0000 (-0500) Subject: Quote attribute and type names properly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61dd0df81ba3e16a358bb9cc284367eeb79b0d46;p=gitmo%2FMoose.git Quote attribute and type names properly --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 2350b3f..f35a85a 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -675,6 +675,7 @@ sub _inline_check_constraint { return unless $self->has_type_constraint; my $attr_name = quotemeta($self->name); + my $type_name = quotemeta($self->type_constraint->name); if ( $self->type_constraint->can_be_inlined ) { return ( @@ -686,8 +687,8 @@ sub _inline_check_constraint { . $message . '->(' . $value . ')' . '}', 'class => "Moose::Exception::TypeConstraint",' . - 'attribute_name => ' . $attr_name . ',' . - 'type_name => ' . $type_name . ',' . + 'attribute_name => \'' . $attr_name . '\',' . + 'type_name => \'' . $type_name . '\',' . 'value => ' . $value ) . ';', '}', @@ -703,8 +704,8 @@ sub _inline_check_constraint { . $message . '->(' . $value . ')' . '}', 'class => "Moose::Exception::TypeConstraint",' . - 'attribute_name => ' . $attr_name . ',' . - 'type_name => ' . $type_name . ',' . + 'attribute_name => \'' . $attr_name . '\',' . + 'type_name => \'' . $type_name . '\',' . 'value => ' . $value ) . ';', '}',