| 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
Condition66%2/3
builtin::blessed($_[0]) and $_[0]->isa("Class::MOP::Mixin::AttributeCore")
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")
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||