blib/lib/Moose/Exception/InvalidArgumentToMethod.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 23 / 23 CC 3 SCAR 9.2
CC
3
Cov
100%
_build_message
3.0
BEGIN
1.0
CRAP 2.5
« blib/lib/Moose/Exception/AttributeIsRequired.pm ↑ Summary blib/lib/Moose/Exception/MethodExpectsFewerArgs.pm »
1 package Moose::Exception::InvalidArgumentToMethod;
2 8 our $VERSION = '2.4001';
3  
4 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 extends 'Moose::Exception';
6  
7 8 has 'argument' => (
8 is => 'ro',
9 isa => 'Any',
10 required => 1
11 );
12  
13 8 has [qw(type type_of_argument method_name)] => (
14 is => 'ro',
15 isa => 'Str',
16 required => 1
17 );
18  
19 8 has 'ordinal' => (
20 is => 'ro',
21 isa => 'Str',
22 predicate => 'is_ordinal_set'
23 );
24  
25 8 has 'argument_noun' => (
26 is => 'ro',
27 isa => 'Str',
28 default => 'argument'
29 );
30  
31 272 ▶sub _build_message {
Subroutine _build_message: called CC=3 SCAR=11.0
32 272 my $self = shift;
33 272 ▶ my $article = ( $self->type_of_argument =~ /^[aeiou]/ ? 'an ' : 'a ');
Branch: 1 branch
BranchTrueFalseTotal
$self->type_of_argument =~ /^[aeiou]/ ? : 89 183 272
34 272 my $arg_noun = $self->argument_noun;
35  
36 272 ▶ if( $self->is_ordinal_set ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_ordinal_set) { } 90 182 272
37 90 "The ".$self->ordinal." $arg_noun passed to ".$self->method_name." must be ".$article.$self->type_of_argument;
38 }
39 else {
40 182 "The $arg_noun passed to ".$self->method_name." must be ".$article.$self->type_of_argument;
41 }
42 }
43  
44 8 __PACKAGE__->meta->make_immutable;
45 8 1;
« blib/lib/Moose/Exception/AttributeIsRequired.pm ↑ Summary blib/lib/Moose/Exception/MethodExpectsFewerArgs.pm »