File Coverage

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


line stmt bran cond sub pod time code
1             package Moose::Exception::RoleExclusionConflict;
2             our $VERSION = '2.2206';
3              
4 3     3   1642 use Moose;
  3         8  
  3         20  
5             extends 'Moose::Exception';
6             with 'Moose::Exception::Role::Role';
7              
8             has 'roles' => (
9             is => 'ro',
10             isa => 'ArrayRef',
11             required => 1,
12             );
13              
14             sub _build_message {
15 6     6   12 my $self = shift;
16              
17 6         10 my @roles_array = @{$self->roles};
  6         185  
18 6 100       25 my $role_noun = "Role".( @roles_array == 1 ? '' : 's');
19 6         20 my $all_roles = join(', ', @roles_array);
20 6 100       25 my $verb = "exclude".( @roles_array == 1 ? 's' : '' );
21 6         225 my $role_name = $self->role_name;
22              
23 6         162 return "Conflict detected: $role_noun $all_roles $verb role '$role_name'";
24             }
25              
26             __PACKAGE__->meta->make_immutable;
27             1;