return 'Moose::Util::throw(' .
'message => ' . $msg .
($args ? (', ' . $args) : '')
- . ');';
+ . ')';
}
sub new {
. 'do { local $_ = ' . $value . '; '
. $message . '->(' . $value . ')'
. '}',
- 'class => "Moose::Exception::TypeConstraint"',
- 'attribute_name => ' . $self->name,
- 'type_name => ' . $self->type_constraint->name,
- 'value => ' . $value,
+ 'class => "Moose::Exception::TypeConstraint",' .
+ 'attribute_name => ' . $attr_name . ',' .
+ 'type_name => ' . $type_name . ',' .
+ 'value => ' . $value
) . ';',
'}',
);
. 'do { local $_ = ' . $value . '; '
. $message . '->(' . $value . ')'
. '}',
- 'class => "Moose::Exception::TypeConstraint"',
- 'attribute_name => ' . $self->name,
- 'type_name => ' . $self->type_constraint->name,
- 'value => ' . $value,
+ 'class => "Moose::Exception::TypeConstraint",' .
+ 'attribute_name => ' . $attr_name . ',' .
+ 'type_name => ' . $type_name . ',' .
+ 'value => ' . $value
) . ';',
'}',
);
$type_constraint->check($val)
|| $self->throw_error(
- superclass => 'Moose::Exception::TypeConstraint',
+ class => 'Moose::Exception::TypeConstraint',
message => "Attribute ("
. $self->name
. ") does not pass the type constraint because: "
. $type_constraint->get_message($val),
- value => $val,
- attribute_name => $self->name,
- type_name => $type_constraint->name,
- @_);
+ value => $val,
+ attribute_name => $self->name,
+ type_name => $type_constraint->name,
+ @_);
}
package Moose::Meta::Attribute::Custom::Moose;