« blib/lib/Moose/Meta/Method/Augmented.pm
↑ Summary
blib/lib/Moose/Exception/OverrideConflictInSummation.pm »
| 1 | package Moose::Exception::OverloadConflictInSummation; | ||||||||||
| 2 | 1 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | extends 'Moose::Exception'; | |||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Moose::Util 'find_meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | has 'role_application' => ( | |||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | isa => 'Moose::Meta::Role::Application::RoleSummation', | ||||||||||
| 12 | required => 1 | ||||||||||
| 13 | ); | ||||||||||
| 14 | |||||||||||
| 15 | 1 | has 'role_names' => ( | |||||||||
| 16 | traits => ['Array'], | ||||||||||
| 17 | is => 'bare', | ||||||||||
| 18 | isa => 'ArrayRef[Str]', | ||||||||||
| 19 | handles => { | ||||||||||
| 20 | role_names => 'elements', | ||||||||||
| 21 | }, | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | documentation => | ||||||||||
| 24 | "This attribute is an ArrayRef containing role names, if you want metaobjects\n" | ||||||||||
| 25 | . "associated with these role names, then call method roles on the exception object.\n", | ||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 1 | has 'overloaded_op' => ( | |||||||||
| 29 | is => 'ro', | ||||||||||
| 30 | isa => 'Str', | ||||||||||
| 31 | required => 1, | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub roles { | ||||||||
|
Subroutine
roles: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | 0 | my $self = shift; | |||||||||
| 36 | 0 | my @role_names = $self->role_names; | |||||||||
| 37 | 0 | my @roles = map { find_meta($_) } @role_names; | |||||||||
| 38 | 0 | return @roles; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 6 | ▶ | sub _build_message { | ||||||||
|
Subroutine
_build_message: called CC=2 SCAR=6.9
| |||||||||||
| 42 | 6 | my $self = shift; | |||||||||
| 43 | |||||||||||
| 44 | 6 | my @roles = $self->role_names; | |||||||||
| 45 | 6 | my $role_names = join "|", @roles; | |||||||||
| 46 | |||||||||||
| 47 | 6 | my $op = $self->overloaded_op; | |||||||||
| 48 | 6 | ▶ | if ( $op eq 'fallback' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | return | ||||||||||
| 50 | 2 | 'We have encountered an overloading conflict for the fallback ' | |||||||||
| 51 | . 'during composition. This is a fatal error.'; | ||||||||||
| 52 | } | ||||||||||
| 53 | else { | ||||||||||
| 54 | return | ||||||||||
| 55 | 4 | "Role '$role_names' has encountered an overloading conflict " | |||||||||
| 56 | . "during composition. The two roles both overload the '$op' operator. " | ||||||||||
| 57 | . 'This is a fatal error.'; | ||||||||||
| 58 | } | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 62 | 1 | 1; | |||||||||