blib/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 19 / 19 CC 2 SCAR 5.1
CC
2
Cov
100%
_build_message
2.0
BEGIN
1.0
CRAP 1.7
« 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
BranchTrueFalseTotal
unless $self->is_attribute_set 3 946 949
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;
« blib/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm ↑ Summary blib/lib/Moose/Exception/WrapTakesACodeRefToBless.pm »