| 1 | package MooseX::MethodAttributes::Role::Meta::Map; | ||||||||||||
| 2 | # ABSTRACT: generic role for storing code attributes used by classes and roles with attributes | ||||||||||||
| 3 | |||||||||||||
| 4 | 21 | our $VERSION = '0.32'; | |||||||||||
| 5 | |||||||||||||
| 6 | 21 | ▶ | use Moose::Role; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 21 | ▶ | use namespace::autoclean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | has _method_attribute_map => ( | ||||||||||||
| 11 | is => 'ro', | ||||||||||||
| 12 | isa => 'HashRef[ArrayRef[Str]]', | ||||||||||||
| 13 | lazy => 1, | ||||||||||||
| 14 | 45 | ▶ | default => sub { +{} }, | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 21 | ); | |||||||||||
| 16 | |||||||||||||
| 17 | has _method_attribute_list => ( | ||||||||||||
| 18 | is => 'ro', | ||||||||||||
| 19 | isa => 'ArrayRef[Int]', | ||||||||||||
| 20 | lazy => 1, | ||||||||||||
| 21 | 47 | ▶ | default => sub { [] }, | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 21 | ); | |||||||||||
| 23 | |||||||||||||
| 24 | #pod =method register_method_attributes ($code, $attrs) | ||||||||||||
| 25 | #pod | ||||||||||||
| 26 | #pod Register a list of attributes for a code reference. | ||||||||||||
| 27 | #pod | ||||||||||||
| 28 | #pod =cut | ||||||||||||
| 29 | |||||||||||||
| 30 | 62 | ▶ | sub register_method_attributes { | ||||||||||
|
Subroutine
register_method_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 31 | 62 | my ($self, $code, $attrs) = @_; | |||||||||||
| 32 | 62 | push @{ $self->_method_attribute_list }, 0 + $code; | |||||||||||
| 33 | 62 | $self->_method_attribute_map->{ 0 + $code } = $attrs; | |||||||||||
| 34 | 62 | return; | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | #pod =method get_method_attributes ($code) | ||||||||||||
| 38 | #pod | ||||||||||||
| 39 | #pod Get a list of attributes associated with a coderef. | ||||||||||||
| 40 | #pod | ||||||||||||
| 41 | #pod =cut | ||||||||||||
| 42 | |||||||||||||
| 43 | 35 | ▶ | sub get_method_attributes { | ||||||||||
|
Subroutine
get_method_attributes: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 44 | 35 | my ($self, $code) = @_; | |||||||||||
| 45 | 35 | ▶ | return $self->_method_attribute_map->{ 0 + $code } || []; | ||||||||||
|
Condition100%2/2
$self->_method_attribute_map->{0 + $code} || []
MC/DC100%1/1
$self->_method_attribute_map->{0 + $code} || []
$self->_method_attribute_map->{0 + $code}
Truth table100%2/2
A
A= $self->_method_attribute_map->{0 + $code}
| |||||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | 21 | 1; | |||||||||||
| 49 | |||||||||||||
| 50 | __END__ | ||||||||||||