ClassAttribute/Trait/Role.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 93.6% 44 / 47 CC 3 SCAR 4.4
CC
3
Cov
97%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« ClassAttribute/Trait/Attribute.pm ↑ Summary ClassAttribute.pm »
1 package MooseX::ClassAttribute::Trait::Role;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 our $VERSION = '0.29';
7  
8 8 ▶use MooseX::ClassAttribute::Meta::Role::Attribute;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 8 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 8 with 'MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes';
15  
16 32 ▶around add_class_attribute => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
17 32 my $orig = shift;
18 32 my $self = shift;
19 32 ▶ my $attr = (
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($_[0]) && $_[0]->isa('Class::MOP::Mixin::AttributeCore') ? : 19 13 32
Condition66%2/3
builtin::blessed($_[0]) and $_[0]->isa("Class::MOP::Mixin::AttributeCore")
!ll&&!rl&&r
13019
MC/DC50%1/2
builtin::blessed($_[0]) and $_[0]->isa("Class::MOP::Mixin::AttributeCore")
builtin::blessed($_[0]) $_[0]->isa("Class::MOP::Mixin::AttributeCore")
Truth table66%2/3
A and B
A= builtin::blessed($_[0])B= $_[0]->isa("Class::MOP::Mixin::AttributeCore")
ABresult
0X0
100
111
20 blessed $_[0] && $_[0]->isa('Class::MOP::Mixin::AttributeCore')
21 ? $_[0]
22 : MooseX::ClassAttribute::Meta::Role::Attribute->new(@_)
23 );
24  
25 32 $self->$orig($attr);
26  
27 32 return $attr;
28 8 };
29  
30 32 ▶sub _attach_class_attribute {
Subroutine _attach_class_attribute: called CC=1 SCAR=0.0
31 32 my ( $self, $attribute ) = @_;
32  
33 32 $attribute->attach_to_role($self);
34 }
35  
36 5 ▶sub composition_class_roles {
Subroutine composition_class_roles: called CC=1 SCAR=0.0
Pod undocumented
37 5 return 'MooseX::ClassAttribute::Trait::Role::Composite';
38 }
39  
40 8 1;
41  
42 # ABSTRACT: A trait for roles with class attributes
43  
44 __END__
« ClassAttribute/Trait/Attribute.pm ↑ Summary ClassAttribute.pm »