Board/Service/WithConstructor.pm

filter: Statementstmt 100% 18 / 18 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 87.8% 29 / 33 CC 4 SCAR 6.5
CC
4
Cov
92%
_build_constructor_name
3.1
__ANON__
2.0
BEGIN
1.0
CRAP 1.9
« Board/LifeCycle/Singleton/WithParameters.pm ↑ Summary Board/LifeCycle/Singleton.pm »
1 package Bread::Board::Service::WithConstructor;
2 67 our $AUTHORITY = 'cpan:STEVAN';
3 67 $Bread::Board::Service::WithConstructor::VERSION = '0.37';
4 67 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 67 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 67 with 'Bread::Board::Service::WithClass';
9  
10 67 has 'constructor_name' => (
11 is => 'rw',
12 isa => 'Str',
13 lazy => 1,
14 builder => '_build_constructor_name',
15 );
16  
17 121 ▶sub _build_constructor_name {
Subroutine _build_constructor_name: called CC=3 SCAR=11.2
18 121 my $self = shift;
19  
20 # using Class::MOP::class_of on a Moo
21 # object causes mayhem, so we take care of that
22 # special case first. See GH#61
23 121 ▶ try { $self->class->isa('Moo::Object') && 'new' }
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$self->class->isa("Moo::Object") and "new" 3 118 121
24 118 ▶ || try { Class::MOP::class_of($self->class)->constructor_name }
Subroutine __ANON__: called CC=1 SCAR=0.0
25 121 ▶ || 'new';
Branch: 1 branch
BranchTrueFalseTotal
&try(sub { $self->class->isa("Moo::Object") and "new"; } ) or &try(sub { Class::MOP::class_of($self->class)->constructor_name; } ) or "new" 121 0 121
Condition66%2/3
&try(sub { $self->class->isa("Moo::Object") and "new"; } ) or &try(sub { Class::MOP::class_of($self->class)->constructor_name; } )
l!l&&r!l&&!r
31180
MC/DC0%0/2
&try(sub { $self->class->isa("Moo::Object") and "new"; } ) or &try(sub { Class::MOP::class_of($self->class)->constructor_name; } )
&try(sub { $self->class->isa("Moo::Object") and "new"; } ) &try(sub { Class::MOP::class_of($self->class)->constructor_name; } )
Truth table66%2/3
A or B
A= &try(sub { $self->class->isa("Moo::Object") and "new"; } )B= &try(sub { Class::MOP::class_of($self->class)->constructor_name; } )
ABresult
1X1
011
000
26 }
27  
28 67 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 __END__
« Board/LifeCycle/Singleton/WithParameters.pm ↑ Summary Board/LifeCycle/Singleton.pm »