blib/lib/Moose/Meta/Method/Constructor.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 4 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 91.6% 44 / 48 CC 5 SCAR 10.4
CC
5
Cov
95%
new
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« blib/lib/Moose/Meta/TypeConstraint/Parameterizable.pm ↑ Summary blib/lib/Moose/Meta/TypeConstraint/Union.pm »
1 package Moose::Meta::Method::Constructor;
2 388 our $VERSION = '2.4001';
3  
4 388 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 388 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 388 ▶use Scalar::Util 'weaken';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 388 ▶use parent 'Moose::Meta::Method',
Subroutine BEGIN: called CC=1 SCAR=0.0
10 388 'Class::MOP::Method::Constructor';
11  
12 388 ▶use Moose::Util 'throw_exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 764 ▶sub new {
Subroutine new: called CC=5 SCAR=16.2
Pod documented
15 764 my $class = shift;
16 764 my %options = @_;
17  
18 764 my $meta = $options{metaclass};
19  
20 764 ▶ (ref $options{options} eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
ref $options{"options"} eq "HASH" or throw_exception("MustPassAHashOfOptions", "params", \%options, "class", $class) 763 1 764
21 || throw_exception( MustPassAHashOfOptions => params => \%options,
22 class => $class
23 );
24  
25 ($options{package_name} && $options{name})
26 763 ▶ || throw_exception( MustSupplyPackageNameAndName => params => \%options,
Branch: 1 branch
BranchTrueFalseTotal
$options{"package_name"} and $options{"name"} or throw_exception("MustSupplyPackageNameAndName", "params", \%options, "class", $class) 762 1 763
Condition66%2/3
$options{"package_name"} and $options{"name"}
!ll&&!rl&&r
10762
MC/DC50%1/2
$options{"package_name"} and $options{"name"}
$options{"package_name"} $options{"name"}
Truth table66%2/3
A and B
A= $options{"package_name"}B= $options{"name"}
ABresult
0X0
100
111
27 class => $class
28 );
29  
30 my $self = bless {
31 'body' => undef,
32 'package_name' => $options{package_name},
33 'name' => $options{name},
34 'options' => $options{options},
35 'associated_metaclass' => $meta,
36 'definition_context' => $options{definition_context},
37 762 ▶ '_expected_method_class' => $options{_expected_method_class} || 'Moose::Object',
Condition50%1/2
$options{'_expected_method_class'} || 'Moose::Object'
l!l
0762
MC/DC0%0/1
$options{'_expected_method_class'} || 'Moose::Object'
$options{'_expected_method_class'}
Truth table50%1/2
A
A= $options{'_expected_method_class'}
Aresult
11
00
38 } => $class;
39  
40 # we don't want this creating
41 # a cycle in the code, if not
42 # needed
43 762 weaken($self->{'associated_metaclass'});
44  
45 762 $self->_initialize_body;
46  
47 761 return $self;
48 }
49  
50 ## method
51  
52 762 ▶sub _initialize_body {
Subroutine _initialize_body: called CC=1 SCAR=0.0
53 762 my $self = shift;
54 762 $self->{'body'} = $self->_generate_constructor_method_inline;
55 }
56  
57 388 1;
58  
59 # ABSTRACT: Method Meta Object for constructors
60  
61 __END__
« blib/lib/Moose/Meta/TypeConstraint/Parameterizable.pm ↑ Summary blib/lib/Moose/Meta/TypeConstraint/Union.pm »