blib/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 22 / 22 CC 2 SCAR 5.1
CC
2
Cov
100%
_build_message
2.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Moose/Exception/RequiredMethodsNotImplementedByClass.pm ↑ Summary blib/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm »
1 package Moose::Exception::ValidationFailedForInlineTypeConstraint;
2 30 our $VERSION = '2.4001';
3  
4 30 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 30 extends 'Moose::Exception';
6 30 with 'Moose::Exception::Role::Class';
7  
8 30 has 'type_constraint_message' => (
9 is => 'ro',
10 isa => 'Str',
11 required => 1
12 );
13  
14 30 has 'attribute_name' => (
15 is => 'ro',
16 isa => 'Str',
17 required => 1
18 );
19  
20 30 has 'value' => (
21 is => 'ro',
22 isa => 'Any',
23 required => 1
24 );
25  
26 30 has 'new_member' => (
27 is => 'ro',
28 isa => 'Bool',
29 default => 0,
30 predicate => 'is_a_new_member'
31 );
32  
33 1009 ▶sub _build_message {
Subroutine _build_message: called CC=2 SCAR=6.9
34 1009 my $self = shift;
35  
36 1009 my $line1;
37  
38 1009 ▶ if( $self->new_member ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->new_member) { } 907 102 1009
39 907 $line1 = "A new member value for ".$self->attribute_name." does not pass its type constraint because: "
40 }
41 else {
42 102 $line1 = "Attribute (".$self->attribute_name.") does not pass the type constraint because: ";
43 }
44  
45 1009 return $line1 . $self->type_constraint_message;
46 }
47  
48 30 __PACKAGE__->meta->make_immutable;
49 30 1;
« blib/lib/Moose/Exception/RequiredMethodsNotImplementedByClass.pm ↑ Summary blib/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm »