File Coverage

blib/lib/Moose/Exception/OverrideConflictInComposition.pm
Criterion Covered Total %
statement 7 7 100.0
branch 2 2 100.0
condition n/a
subroutine 2 2 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package Moose::Exception::OverrideConflictInComposition;
2             our $VERSION = '2.2203';
3              
4 3     3   2063 use Moose;
  3         9  
  3         23  
5             extends 'Moose::Exception';
6             with 'Moose::Exception::Role::Role';
7              
8             has 'role_being_applied_name' => (
9             is => 'ro',
10             isa => 'Str',
11             required => 1
12             );
13              
14             has 'method_name' => (
15             is => 'ro',
16             isa => 'Str',
17             required => 1
18             );
19              
20             has 'two_overrides_found' => (
21             is => 'ro',
22             isa => 'Bool',
23             required => 1,
24             default => 0
25             );
26              
27             sub _build_message {
28 4     4   8 my $self = shift;
29              
30 4 100       128 if( $self->two_overrides_found ) {
31 2         65 return "Role '" . $self->role_being_applied_name . "' has encountered an 'override' method conflict " .
32             "during composition (Two 'override' methods of the same name encountered). " .
33             "This is a fatal error.";
34             }
35             else {
36 2         66 return "Role '".$self->role_being_applied_name."' has encountered an 'override' method conflict ".
37             "during composition (A local method of the same name as been found). ".
38             "This is a fatal error.";
39             }
40             }
41              
42             __PACKAGE__->meta->make_immutable;
43             1;