lib/Reaction/Role/Meta/Class.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran 16.6% 2 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 65.7% 25 / 38 CC 6 SCAR 21.5
CC
6
Cov
63%
__ANON__
11.1
BEGIN
1.0
__ANON__
1.0
CRAP 8.6
« lib/Reaction/UI/Controller/Role/Action/DeleteAll.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/Role/Mutable/Simple.pm »
1 package Reaction::Role::Meta::Class;
2  
3 9 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1084 ▶around initialize => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
6 1084 my $super = shift;
7 1084 my $class = shift;
8 1084 my $pkg = shift;
9 1084 $super->($class, $pkg, 'attribute_metaclass' => 'Reaction::Meta::Attribute', @_ );
10 9 };
11  
12 129 ▶around add_role => sub {
Subroutine __ANON__: called CC=6 SCAR=24.1
13 129 my $orig = shift;
14 129 my $self = shift;
15 129 my ($role) = @_;
16  
17 129 my @roles = grep { !$_->isa('Moose::Meta::Role::Composite') }
18 $role->calculate_all_roles;
19 0 ▶ my @bad_roles = map { Moose::Util::does_role($_, 'MooseX::Role::Parameterized::Meta::Trait::Parameterized') ? $_->genitor->name : $_->name }
Branch: 1 branch
BranchTrueFalseTotal
Moose::Util::does_role($_, 'MooseX::Role::Parameterized::Meta::Trait::Parameterized') ? : 0 0 0
20 81 grep { $_->get_attribute_list > 0 }
21 129 grep { !Moose::Util::does_role($_->applied_attribute_metaclass, 'Reaction::Role::Meta::Attribute') }
22 @roles;
23  
24 129 ▶ if (@bad_roles) {
Branch: 1 branch
BranchTrueFalseTotal
if (@bad_roles) 0 129 129
25 0 my $plural = @bad_roles > 1;
26 0 ▶ warn "You are applying the role" . ($plural ? "s " : " ")
Branch: 3 branches
BranchTrueFalseTotal
$plural ? : 0 0 0
$plural ? : 0 0 0
$plural ? : 0 0 0
27 . join(", ", @bad_roles)
28 . " to the Reaction::Class " . $self->name
29 . ", but " . ($plural ? "these roles do" : "that role does")
30 . " not use Reaction::Role or"
31 . " Reaction::Role::Parameterized. In Moose versions greater than"
32 . " 2.0, this will cause the special behavior of Reaction"
33 . " attributes to no longer be applied to attributes defined"
34 . " in " . ($plural ? "these roles" : "this role")
35 . ". You should replace 'use Moose::Role' with"
36 . " 'use Reaction::Role' or 'use MooseX::Role::Parameterized' with"
37 . " 'use Reaction::Role::Parameterized'.";
38 }
39  
40 129 $self->$orig(@_);
41 9 ▶} if Moose->VERSION >= 1.9900;
Branch: 1 branch
BranchTrueFalseTotal
if "Moose"->VERSION >= "1.99" 9 0 9
42  
43 9 1;
« lib/Reaction/UI/Controller/Role/Action/DeleteAll.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/Role/Mutable/Simple.pm »