line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Exception::MethodNameConflictInRoles; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2206'; |
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
4893
|
use Moose; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
56
|
|
5
|
|
|
|
|
|
|
extends 'Moose::Exception'; |
6
|
|
|
|
|
|
|
with 'Moose::Exception::Role::Class'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'conflict' => ( |
9
|
|
|
|
|
|
|
traits => ['Array'], |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
isa => 'ArrayRef[Moose::Meta::Role::Method::Conflicting]', |
12
|
|
|
|
|
|
|
handles => { conflict_methods_count => 'count', |
13
|
|
|
|
|
|
|
get_method_at => 'get', |
14
|
|
|
|
|
|
|
get_all_methods => 'elements', |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
required => 1 |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _get_method_names { |
20
|
10
|
|
|
10
|
|
28
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return ( $self->conflict_methods_count == 1 ? |
23
|
|
|
|
|
|
|
"'".$self->get_method_at(0)->name."'": |
24
|
10
|
100
|
|
|
|
474
|
Moose::Util::english_list( map { q{'} . $_->name . q{'} } $self->get_all_methods ) ); |
|
4
|
|
|
|
|
123
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_message { |
28
|
10
|
|
|
10
|
|
33
|
my $self = shift; |
29
|
10
|
|
|
|
|
450
|
my $count = $self->conflict_methods_count; |
30
|
10
|
|
|
|
|
461
|
my $roles = $self->get_method_at(0)->roles_as_english_list; |
31
|
|
|
|
|
|
|
|
32
|
10
|
100
|
|
|
|
50
|
if( $count == 1 ) |
33
|
|
|
|
|
|
|
{ |
34
|
8
|
|
|
|
|
55
|
"Due to a method name conflict in roles " |
35
|
|
|
|
|
|
|
.$roles.", the method ".$self->_get_method_names |
36
|
|
|
|
|
|
|
." must be implemented or excluded by '".$self->class_name."'"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
|
|
|
|
|
|
{ |
40
|
2
|
|
|
|
|
14
|
"Due to method name conflicts in roles " |
41
|
|
|
|
|
|
|
.$roles.", the methods ".$self->_get_method_names |
42
|
|
|
|
|
|
|
." must be implemented or excluded by '".$self->class_name."'"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
47
|
|
|
|
|
|
|
1; |