« 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
| |||||||||||||||||||
| 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
| |||||||||||||||||||
| 25 | 0 | my $plural = @bad_roles > 1; | |||||||||||||||||
| 26 | 0 | ▶ | warn "You are applying the role" . ($plural ? "s " : " ") | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 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
| |||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | 9 | 1; | |||||||||||||||||