blib/lib/Moose/Exception/InvalidArgPassedToMooseUtilMetaRole.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 87.5% 7 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 87.8% 29 / 33 CC 6 SCAR 16.8
CC
6
Cov
90%
_build_message
6.1
BEGIN
1.0
CRAP 5.4
« blib/lib/Moose/Meta/Role/Application/ToRole.pm ↑ Summary blib/lib/Moose/Role.pm »
1 package Moose::Exception::InvalidArgPassedToMooseUtilMetaRole;
2 2 our $VERSION = '2.4001';
3  
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 extends 'Moose::Exception';
6  
7 2 has 'argument' => (
8 is => 'ro',
9 isa => 'Any',
10 required => 1
11 );
12  
13 6 ▶sub _build_message {
Subroutine _build_message: called CC=6 SCAR=18.1
14 6 my $self = shift;
15 6 my $error = 'When using Moose::Util::MetaRole, you must pass a Moose class name,'
16 . ' role name, metaclass object, or metarole object.';
17  
18 6 my $arg = $self->argument;
19 6 ▶ my $found = blessed $arg ? $arg : Class::MOP::class_of($arg);
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($arg) ? : 1 5 6
20  
21 6 my $error2;
22  
23 6 ▶ if ( defined $found && blessed $found ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $found and builtin::blessed($found)) { } 3 3 6
elsif (not defined $found) { } 3 0 3
Condition66%2/3
defined $found and builtin::blessed($found)
!ll&&!rl&&r
303
MC/DC50%1/2
defined $found and builtin::blessed($found)
defined $found builtin::blessed($found)
Truth table66%2/3
A and B
A= defined $foundB= builtin::blessed($found)
ABresult
0X0
100
111
24 3 $error2 = " You passed ".$arg.", and we resolved this to a "
25 . ( blessed $found )
26 . ' object.';
27 }
28 elsif ( !defined $found ) {
29 3 ▶ $error2 = " You passed ".( defined $arg ? $arg : "undef" ).", and this did not resolve to a metaclass or metarole."
Branch: 1 branch
BranchTrueFalseTotal
defined $arg ? : 2 1 3
30 . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?';
31 }
32 else {
33 0 $error2 = " You passed an undef."
34 . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?';
35 }
36  
37 6 $error.$error2;
38 }
39  
40 2 __PACKAGE__->meta->make_immutable;
41 2 1;
« blib/lib/Moose/Meta/Role/Application/ToRole.pm ↑ Summary blib/lib/Moose/Role.pm »