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 SCAR 13.9
CC
4
Cov
92%
_build_constructor_name
3.1
__ANON__
2.0
BEGIN
1.0
CRAP 4.0
« Board/Types.pm ↑ Summary Board/LifeCycle/Singleton/WithParameters.pm »
1 package Bread::Board::Service::WithConstructor;
2 67 our $AUTHORITY = 'cpan:STEVAN';
3 67 $Bread::Board::Service::WithConstructor::VERSION = '0.35';
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 sub _build_constructor_name {
18 121 ▶ my $self = shift;
Subroutine _build_constructor_name: called CC=3 SCAR=11.2
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" 0 121 121
Condition66%2/3
&try(sub { or &try(sub {
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__
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 Bread::Board::Service::WithConstructor
39  
40 =head1 VERSION
41  
42 version 0.35
43  
44 =head1 DESCRIPTION
45  
46 =head1 METHODS
47  
48 =over 4
49  
50 =item B<constructor_name>
51  
52 =back
53  
54 =head1 BUGS
55  
56 All complex software has bugs lurking in it, and this module is no
57 exception. If you find a bug please either email me, or add the bug
58 to cpan-RT.
59  
60 =head1 AUTHOR
61  
62 Stevan Little <stevan@iinteractive.com>
63  
64 =head1 BUGS
65  
66 Please report any bugs or feature requests on the bugtracker website
67 https://github.com/stevan/BreadBoard/issues
68  
69 When submitting a bug or request, please include a test-file or a
70 patch to an existing test-file that illustrates the bug or desired
71 feature.
72  
73 =head1 COPYRIGHT AND LICENSE
74  
75 This software is copyright (c) 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive.
76  
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.
79  
80 =cut
« Board/Types.pm ↑ Summary Board/LifeCycle/Singleton/WithParameters.pm »