blib/lib/Class/MOP/Method/Generated.pm

filter: Statementstmt 100% 32 / 32 Branchbran 78.5% 11 / 14 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 87.6% 57 / 65 CC 10 SCAR 15.8
CC
10
Cov
90%
_generate_description
8.5
_compile_code
3.0
BEGIN
1.0
CRAP 4.9
« blib/lib/Class/MOP/Class.pm ↑ Summary blib/lib/Moose/Meta/Role/Attribute.pm »
1 package Class::MOP::Method::Generated;
2 459 our $VERSION = '2.4001';
3  
4 459 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 459 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 459 ▶use Eval::Closure;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 459 ▶use parent 'Class::MOP::Method';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 ## accessors
12  
13 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 1 $_[0]->_throw_exception( CannotCallAnAbstractBaseMethod => package_name => __PACKAGE__ );
15 }
16  
17 1 ▶sub _initialize_body {
Subroutine _initialize_body: called CC=1 SCAR=0.0
18 1 $_[0]->_throw_exception( NoBodyToInitializeInAnAbstractBaseClass => package_name => __PACKAGE__ );
19 }
20  
21 54598 ▶sub _generate_description {
Subroutine _generate_description: called CC=8 SCAR=21.3
22 54598 my ( $self, $context ) = @_;
23 54598 ▶ $context ||= $self->definition_context;
Condition66%2/3
$context ||= $self->definition_context
l!l&&r!l&&!r
05454751
MC/DC50%1/2
$context ||= $self->definition_context
$context $self->definition_context
Truth table66%2/3
A ||= B
A= $contextB= $self->definition_context
ABresult
1X1
011
000
24  
25 54598 my $desc = "generated method";
26 54598 my $origin = "unknown origin";
27  
28 54598 ▶ if (defined $context) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $context) 54547 51 54598
29 54547 ▶ if (defined $context->{description}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $context->{"description"}) 54547 0 54547
30 54547 $desc = $context->{description};
31 }
32  
33 54547 ▶ if (defined $context->{file} || defined $context->{line}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $context->{"file"} or defined $context->{"line"}) 53664 883 54547
Condition66%2/3
defined $context->{"file"} or defined $context->{"line"}
l!l&&r!l&&!r
536640883
MC/DC50%1/2
defined $context->{"file"} or defined $context->{"line"}
defined $context->{"file"} defined $context->{"line"}
Truth table66%2/3
A or B
A= defined $context->{"file"}B= defined $context->{"line"}
ABresult
1X1
011
000
34 $origin = "defined at "
35 . (defined $context->{file}
36 ? $context->{file} : "<unknown file>")
37 . " line "
38 . (defined $context->{line}
39 53664 ▶ ? $context->{line} : "<unknown line>");
Branch: 2 branches
BranchTrueFalseTotal
defined $context->{'file'} ? : 53664 0 53664
defined $context->{'line'} ? : 53664 0 53664
40 }
41 }
42  
43 54598 return "$desc ($origin)";
44 }
45  
46 54599 ▶sub _compile_code {
Subroutine _compile_code: called CC=3 SCAR=11.0
47 54599 my ( $self, @args ) = @_;
48 54599 ▶ unshift @args, 'source' if @args % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 53792 807 54599
49 54599 my %args = @args;
50  
51 54599 my $context = delete $args{context};
52 54599 ▶ my $environment = $self->can('_eval_environment')
Branch: 1 branch
BranchTrueFalseTotal
$self->can('_eval_environment') ? : 16790 37809 54599
53 ? $self->_eval_environment
54 : {};
55  
56 54598 return eval_closure(
57 environment => $environment,
58 description => $self->_generate_description($context),
59 %args,
60 );
61 }
62  
63 459 1;
64  
65 # ABSTRACT: Abstract base class for generated methods
66  
67 __END__
« blib/lib/Class/MOP/Class.pm ↑ Summary blib/lib/Moose/Meta/Role/Attribute.pm »