blib/lib/Moose/Exception/RequiredMethodsImportedByClass.pm

filter: Statementstmt 100% 17 / 17 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 95.2% 20 / 21 CC 2 SCAR 5.1
CC
2
Cov
95%
_build_message
2.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Moose/Exception/MethodNameConflictInRoles.pm ↑ Summary blib/lib/Moose/Exception/EnumValuesMustBeString.pm »
1 package Moose::Exception::RequiredMethodsImportedByClass;
2 2 our $VERSION = '2.4001';
3  
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 extends 'Moose::Exception';
6 2 with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Role';
7  
8 2 has 'missing_methods' => (
9 traits => ['Array'],
10 is => 'ro',
11 isa => 'ArrayRef[Moose::Meta::Role::Method::Required]',
12 handles => { method_count => 'count',
13 get_method_at => 'get',
14 get_all_methods => 'elements',
15 },
16 required => 1
17 );
18  
19 2 has 'imported_method' => (
20 is => 'ro',
21 isa => 'Moose::Meta::Role::Method::Required',
22 required => 1
23 );
24  
25 2 ▶sub _build_message {
Subroutine _build_message: called CC=2 SCAR=7.0
26 2 my $self = shift;
27  
28 2 ▶ my $noun = $self->method_count == 1 ? 'method' : 'methods';
Branch: 1 branch
BranchTrueFalseTotal
$self->method_count == 1 ? : 2 0 2
29 2 my $list = Moose::Util::english_list( map { q{'} . $_ . q{'} } $self->get_all_methods );
30  
31 2 my ($class, $role, $method) = ($self->class_name,
32 $self->role_name,
33 $self->imported_method);
34  
35 2 my ($class_quoted, $role_quoted) = ("'".$class."'","'".$role."'");
36  
37 2 "$role_quoted requires the $noun $list "
38 . "to be implemented by $class_quoted. "
39 . "If you imported functions intending to use them as "
40 . "methods, you need to explicitly mark them as such, via "
41 . "$class->meta->add_method($method"
42 . " => \\&$method)";
43 }
44  
45 2 __PACKAGE__->meta->make_immutable;
46 2 1;
« blib/lib/Moose/Exception/MethodNameConflictInRoles.pm ↑ Summary blib/lib/Moose/Exception/EnumValuesMustBeString.pm »