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 (
. $message . '->(' . $value . ')'
. '}',
'class => "Moose::Exception::TypeConstraint",' .
- 'attribute_name => ' . $attr_name . ',' .
- 'type_name => ' . $type_name . ',' .
+ 'attribute_name => \'' . $attr_name . '\',' .
+ 'type_name => \'' . $type_name . '\',' .
'value => ' . $value
) . ';',
'}',
. $message . '->(' . $value . ')'
. '}',
'class => "Moose::Exception::TypeConstraint",' .
- 'attribute_name => ' . $attr_name . ',' .
- 'type_name => ' . $type_name . ',' .
+ 'attribute_name => \'' . $attr_name . '\',' .
+ 'type_name => \'' . $type_name . '\',' .
'value => ' . $value
) . ';',
'}',