| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
4
|
|
|
4
|
|
187457
|
use strict; # redundant, but quiets perlcritic |
|
|
4
|
|
|
|
|
14
|
|
|
|
4
|
|
|
|
|
229
|
|
|
2
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
396
|
|
|
3
|
|
|
|
|
|
|
package MooX::StrictConstructor::Role::Constructor::Base; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.013'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
611
|
use Moo::Role; |
|
|
4
|
|
|
|
|
18301
|
|
|
|
4
|
|
|
|
|
33
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _check_strict { |
|
10
|
7
|
|
|
7
|
|
25
|
my ($self, $spec, $arg) = @_; |
|
11
|
|
|
|
|
|
|
my $captures = { |
|
12
|
|
|
|
|
|
|
'%MooX_StrictConstructor_attrs' => { |
|
13
|
|
|
|
|
|
|
map +($_ => 1), |
|
14
|
|
|
|
|
|
|
grep defined, |
|
15
|
|
|
|
|
|
|
map $_->{init_arg}, |
|
16
|
7
|
|
|
|
|
75
|
values %$spec, |
|
17
|
|
|
|
|
|
|
}, |
|
18
|
|
|
|
|
|
|
}; |
|
19
|
7
|
|
|
|
|
24
|
my $code = sprintf(<<'END_CODE', $arg); |
|
20
|
|
|
|
|
|
|
if ( my @bad = grep !exists $MooX_StrictConstructor_attrs{$_}, keys %%{%s} ) { |
|
21
|
|
|
|
|
|
|
require Carp; |
|
22
|
|
|
|
|
|
|
Carp::croak( |
|
23
|
|
|
|
|
|
|
"Found unknown attribute(s) passed to the constructor: " . |
|
24
|
|
|
|
|
|
|
join(", ", sort @bad) |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
END_CODE |
|
28
|
7
|
|
|
|
|
30
|
return ($code, $captures); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |