| 1 | package MooseX::Does::Delegated; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use if $] < 5.010, 'UNIVERSAL::DOES'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | $MooseX::Does::Delegated::AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||
| 10 | 2 | $MooseX::Does::Delegated::VERSION = '0.004'; | |||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | around DOES => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=27.8
| |||||||||||||||||||||||||||||
| 16 | 2 | my ($orig, $self, $role) = @_; | |||||||||||||||||||||||||||
| 17 | 2 | ▶ | return 1 if $self->$orig($role); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | return unless blessed($self); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 1 | for my $attr ($self->meta->get_all_attributes) { | |||||||||||||||||||||||||||
| 20 | 1 | ▶ | next unless $attr->has_handles; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 1 | my $handles = $attr->handles; | |||||||||||||||||||||||||||
| 22 | 1 | ▶ | next if ref $handles; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | next unless $attr->has_value($self) || $attr->is_lazy; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$attr->has_value($self) or $attr->is_lazy
MC/DC0%0/2
$attr->has_value($self) or $attr->is_lazy
$attr->has_value($self)
$attr->is_lazy
Truth table33%1/3
A or B
A= $attr->has_value($self)B= $attr->is_lazy
| |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | return 1 if $role eq $handles; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | return 1 if Class::MOP::class_of($handles)->does_role($role); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | 0 | return; | |||||||||||||||||||||||||||
| 28 | 2 | }; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Allow import method to work, yet hide it from role method list. | ||||||||||||||||||||||||||||
| 31 | 2 | our @ISA = do { | |||||||||||||||||||||||||||
| 32 | package # Hide from CPAN indexer too. | ||||||||||||||||||||||||||||
| 33 | MooseX::Does::Delegated::__ANON__::0001; | ||||||||||||||||||||||||||||
| 34 | 2 | ▶ | use Moose::Util qw(ensure_all_roles); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 36 | 2 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 38 | 1 | ▶ | ensure_all_roles('Moose::Object', $class) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | if $_[0] =~ /^[-](?:everywhere|rafl)/; | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | 2 | __PACKAGE__; | |||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | ▶ | no Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 2 | __PACKAGE__ | |||||||||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||||||||||