Foreign/Meta/Role/Method/Constructor.pm

filter: Statementstmt 100% 26 / 26 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 94.8% 37 / 39 CC 5 SCAR 8.5
CC
5
Cov
94%
__ANON__
3.0
new
3.0
__ANON__
1.0
CRAP 2.3
« Foreign/Meta/Role/Class.pm ↑ Summary Foreign/Meta/Role/Method/Destructor.pm »
1 package MouseX::Foreign::Meta::Role::Method::Constructor;
2 30 ▶use Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 72 ▶around _generate_constructor => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
5 72 my($next, undef, $meta, $option) = @_;
6  
7 # The foreign superlcass must have the new method
8 72 my $foreign_buildargs = $meta->name->can('FOREIGNBUILDARGS');
9 72 my $foreign_superclass = $meta->foreign_superclass;
10 72 my $super_new = $foreign_superclass->can('new');
11 72 my $needs_buildall = !$foreign_superclass->can('BUILDALL');
12  
13 49 ▶ return sub {
Subroutine new: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=3 SCAR=11.0
14 49 my $class = shift;
15 49 my $args = $class->BUILDARGS(@_);
16 49 ▶ my $object = $foreign_buildargs
Branch: 2 branches
BranchTrueFalseTotal
$foreign_buildargs ? : 20 29 49
$foreign_buildargs ? : 4 20 24
17 ? $class->$super_new($class->$foreign_buildargs(@_))
18 : $class->$super_new( @_ );
19 49 $object->meta->_initialize_object($object, $args);
20 49 ▶ $object->BUILDALL($args) if $needs_buildall;
Branch: 2 branches
BranchTrueFalseTotal
if $needs_buildall 49 0 49
if $needs_buildall 24 0 24
21  
22 49 return $object;
23 72 };
24 17 };
25  
26 30 ▶no Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 17 1;
28 __END__
« Foreign/Meta/Role/Class.pm ↑ Summary Foreign/Meta/Role/Method/Destructor.pm »