| 1 | package Moose::Meta::Role::Application; | ||||||||||
| 2 | 385 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 385 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 385 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 385 | ▶ | use metaclass; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 385 | ▶ | use overload (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 385 | ▶ | use List::Util 1.33 qw( all ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 385 | ▶ | use Moose::Util 'throw_exception'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | __PACKAGE__->meta->add_attribute('method_exclusions' => ( | ||||||||||
| 14 | init_arg => '-excludes', | ||||||||||
| 15 | reader => 'get_method_exclusions', | ||||||||||
| 16 | 1895 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 385 | Class::MOP::_definition_context(), | |||||||||
| 18 | )); | ||||||||||
| 19 | |||||||||||
| 20 | __PACKAGE__->meta->add_attribute('method_aliases' => ( | ||||||||||
| 21 | init_arg => '-alias', | ||||||||||
| 22 | reader => 'get_method_aliases', | ||||||||||
| 23 | 1886 | ▶ | default => sub { {} }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 385 | Class::MOP::_definition_context(), | |||||||||
| 25 | )); | ||||||||||
| 26 | |||||||||||
| 27 | 1908 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 1908 | my ($class, %params) = @_; | |||||||||
| 29 | 1908 | $class->_new(\%params); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 14509 | ▶ | sub is_method_excluded { | ||||||||
|
Subroutine
is_method_excluded: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 33 | 14509 | my ($self, $method_name) = @_; | |||||||||
| 34 | 14509 | foreach (@{$self->get_method_exclusions}) { | |||||||||
| 35 | 30 | ▶ | return 1 if $_ eq $method_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | 14490 | return 0; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 14494 | ▶ | sub is_method_aliased { | ||||||||
|
Subroutine
is_method_aliased: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | 14494 | my ($self, $method_name) = @_; | |||||||||
| 42 | 14494 | ▶ | exists $self->get_method_aliases->{$method_name} ? 1 : 0 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 682 | ▶ | sub is_aliased_method { | ||||||||
|
Subroutine
is_aliased_method: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 46 | 682 | my ($self, $method_name) = @_; | |||||||||
| 47 | 682 | my %aliased_names = reverse %{$self->get_method_aliases}; | |||||||||
| 48 | 682 | ▶ | exists $aliased_names{$method_name} ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 1882 | ▶ | sub apply { | ||||||||
|
Subroutine
apply: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | 1882 | my $self = shift; | |||||||||
| 53 | |||||||||||
| 54 | 1882 | $self->check_role_exclusions(@_); | |||||||||
| 55 | 1872 | $self->check_required_methods(@_); | |||||||||
| 56 | 1844 | $self->check_required_attributes(@_); | |||||||||
| 57 | |||||||||||
| 58 | 1844 | $self->apply_overloading(@_); | |||||||||
| 59 | 1838 | $self->apply_attributes(@_); | |||||||||
| 60 | 1831 | $self->apply_methods(@_); | |||||||||
| 61 | |||||||||||
| 62 | 1827 | $self->apply_override_method_modifiers(@_); | |||||||||
| 63 | |||||||||||
| 64 | 1815 | $self->apply_before_method_modifiers(@_); | |||||||||
| 65 | 1815 | $self->apply_around_method_modifiers(@_); | |||||||||
| 66 | 1815 | $self->apply_after_method_modifiers(@_); | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 1 | ▶ | sub check_role_exclusions { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
check_role_exclusions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 70 | 1 | ▶ | sub check_required_methods { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
check_required_methods: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 71 | 1 | ▶ | sub check_required_attributes { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
check_required_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | |||||||||||
| 73 | 1 | ▶ | sub apply_attributes { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
apply_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 74 | 1 | ▶ | sub apply_methods { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
apply_methods: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 75 | 1 | ▶ | sub apply_override_method_modifiers { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
apply_override_method_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 76 | 1 | ▶ | sub apply_method_modifiers { throw_exception( "CannotCallAnAbstractMethod" ); } | ||||||||
|
Subroutine
apply_method_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 77 | |||||||||||
| 78 | 1815 | ▶ | sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) } | ||||||||
|
Subroutine
apply_before_method_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 79 | 1815 | ▶ | sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) } | ||||||||
|
Subroutine
apply_around_method_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 80 | 1815 | ▶ | sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) } | ||||||||
|
Subroutine
apply_after_method_modifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 81 | |||||||||||
| 82 | 1595 | ▶ | sub apply_overloading { | ||||||||
|
Subroutine
apply_overloading: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 83 | 1595 | my ( $self, $role, $other ) = @_; | |||||||||
| 84 | |||||||||||
| 85 | 1595 | ▶ | return unless $role->is_overloaded; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | |||||||||||
| 87 | 16 | ▶ | unless ( $other->is_overloaded ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 15 | $other->set_overload_fallback_value( | |||||||||
| 89 | $role->get_overload_fallback_value ); | ||||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | 16 | for my $overload ( $role->get_all_overloaded_operators ) { | |||||||||
| 93 | 17 | ▶ | next if $other->has_overloaded_operator( $overload->operator ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 16 | $other->add_overloaded_operator( | |||||||||
| 95 | $overload->operator => $overload->clone ); | ||||||||||
| 96 | } | ||||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 385 | 1; | |||||||||
| 100 | |||||||||||
| 101 | # ABSTRACT: A base class for role application | ||||||||||
| 102 | |||||||||||
| 103 | __END__ | ||||||||||