| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 
 | package Moose::Exception::OverrideConflictInSummation;
our $VERSION = '2.4000';
use Moose;
extends 'Moose::Exception';
use Moose::Util 'find_meta';
has 'role_application' => (
    is       => 'ro',
    isa      => 'Moose::Meta::Role::Application::RoleSummation',
    required => 1
);
has 'role_names' => (
    traits   => ['Array'],
    is       => 'bare',
    isa      => 'ArrayRef[Str]',
    handles  => {
        role_names      => 'elements',
    },
    required => 1,
    documentation => "This attribute is an ArrayRef containing role names, if you want metaobjects\n".
                     "associated with these role names, then call method roles on the exception object.\n",
);
has 'method_name' => (
    is       => 'ro',
    isa      => 'Str',
    required => 1
);
has 'two_overrides_found' => (
    is       => 'ro',
    isa      => 'Bool',
    required => 1,
    default  => 0
);
sub roles {
    my $self = shift;
    my @role_names = $self->role_names;
    my @roles = map { find_meta($_) } @role_names;
    return @roles;
}
sub _build_message {
    my $self = shift;
    my @roles = $self->role_names;
    my $role_names = join "|", @roles;
    if( $self->two_overrides_found ) {
        return "We have encountered an 'override' method conflict ".
               "during composition (Two 'override' methods of the same name encountered). ".
               "This is a fatal error.";
    }
    else {
        return "Role '$role_names' has encountered an 'override' method conflict " .
               "during composition (A local method of the same name has been found). This " .
               "is a fatal error." ;
    }
}
__PACKAGE__->meta->make_immutable;
1;
 |