« blib/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm
↑ Summary
blib/lib/Moose/Exception/WrapTakesACodeRefToBless.pm »
| 1 | package Moose::Exception::ValidationFailedForTypeConstraint; | ||||||||||
| 2 | 19 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 19 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 19 | extends 'Moose::Exception'; | |||||||||
| 6 | 19 | with 'Moose::Exception::Role::Attribute'; | |||||||||
| 7 | |||||||||||
| 8 | 19 | has 'value' => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | isa => 'Any', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 19 | has 'type' => ( | |||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | isa => Moose::Util::TypeConstraints->duck_type(["get_message", "name"]), | ||||||||||
| 17 | required => 1 | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 949 | ▶ | sub _build_message { | ||||||||
|
Subroutine
_build_message: called CC=2 SCAR=6.9
| |||||||||||
| 21 | 949 | my $self = shift; | |||||||||
| 22 | |||||||||||
| 23 | 949 | my $error = $self->type->get_message( $self->value ); | |||||||||
| 24 | |||||||||||
| 25 | 949 | ▶ | return $error unless $self->is_attribute_set; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 946 | my $attribute_name = $self->attribute->name; | |||||||||
| 28 | return | ||||||||||
| 29 | 946 | "Attribute ($attribute_name) does not pass the type constraint because: $error"; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 19 | __PACKAGE__->meta->make_immutable; | |||||||||
| 33 | 19 | 1; | |||||||||