« blib/lib/Moose/Exception/OverloadConflictInSummation.pm
↑ Summary
blib/lib/Moose/Exception/CannotMakeMetaclassCompatible.pm »
| 1 | package Moose::Exception::OverrideConflictInSummation; | ||||||||||
| 2 | 3 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | extends 'Moose::Exception'; | |||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use Moose::Util 'find_meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | has 'role_application' => ( | |||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | isa => 'Moose::Meta::Role::Application::RoleSummation', | ||||||||||
| 12 | required => 1 | ||||||||||
| 13 | ); | ||||||||||
| 14 | |||||||||||
| 15 | 3 | 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 => "This attribute is an ArrayRef containing role names, if you want metaobjects\n". | ||||||||||
| 24 | "associated with these role names, then call method roles on the exception object.\n", | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 3 | has 'method_name' => ( | |||||||||
| 28 | is => 'ro', | ||||||||||
| 29 | isa => 'Str', | ||||||||||
| 30 | required => 1 | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 3 | has 'two_overrides_found' => ( | |||||||||
| 34 | is => 'ro', | ||||||||||
| 35 | isa => 'Bool', | ||||||||||
| 36 | required => 1, | ||||||||||
| 37 | default => 0 | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub roles { | ||||||||
|
Subroutine
roles: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 0 | my $self = shift; | |||||||||
| 42 | 0 | my @role_names = $self->role_names; | |||||||||
| 43 | 0 | my @roles = map { find_meta($_) } @role_names; | |||||||||
| 44 | 0 | return @roles; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 7 | ▶ | sub _build_message { | ||||||||
|
Subroutine
_build_message: called CC=2 SCAR=6.9
| |||||||||||
| 48 | 7 | my $self = shift; | |||||||||
| 49 | |||||||||||
| 50 | 7 | my @roles = $self->role_names; | |||||||||
| 51 | 7 | my $role_names = join "|", @roles; | |||||||||
| 52 | |||||||||||
| 53 | 7 | ▶ | if( $self->two_overrides_found ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 4 | return "We have encountered an 'override' method conflict ". | |||||||||
| 55 | "during composition (Two 'override' methods of the same name encountered). ". | ||||||||||
| 56 | "This is a fatal error."; | ||||||||||
| 57 | } | ||||||||||
| 58 | else { | ||||||||||
| 59 | 3 | return "Role '$role_names' has encountered an 'override' method conflict " . | |||||||||
| 60 | "during composition (A local method of the same name has been found). This " . | ||||||||||
| 61 | "is a fatal error." ; | ||||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||
| 66 | 3 | 1; | |||||||||