Validate/Exception/ValidationFailedForTypeConstraint.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 34 / 34 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Validate.pm ↑ Summary
1 package MooseX::Params::Validate::Exception::ValidationFailedForTypeConstraint;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 our $VERSION = '0.21';
7  
8 16 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Moose::Util::TypeConstraints qw( duck_type );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 extends 'Moose::Exception';
12  
13 16 has parameter => (
14 is => 'ro',
15 isa => 'Str',
16 required => 1,
17 );
18  
19 16 has value => (
20 is => 'ro',
21 isa => 'Any',
22 required => 1,
23 );
24  
25 16 has type => (
26 is => 'ro',
27 isa => duck_type( [qw( get_message name )] ),
28 required => 1,
29 );
30  
31 68 ▶sub _build_message {
Subroutine _build_message: called CC=1 SCAR=0.0
32 68 my $self = shift;
33  
34 return
35 68 $self->parameter
36 . ' does not pass the type constraint because: '
37 . $self->type()->get_message( $self->value() );
38 }
39  
40 16 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 16 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 16 __PACKAGE__->meta()->make_immutable();
44  
45 16 1;
46  
47 # ABSTRACT: Exception thrown when a type constraint check fails
48  
49 __END__
« Validate.pm ↑ Summary