| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
348891
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
89
|
|
|
2
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
216
|
|
|
3
|
|
|
|
|
|
|
package MooX::StrictConstructor; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.013'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
821
|
use Moo (); |
|
|
2
|
|
|
|
|
11988
|
|
|
|
2
|
|
|
|
|
50
|
|
|
8
|
2
|
|
|
2
|
|
1098
|
use Moo::Role (); |
|
|
2
|
|
|
|
|
20732
|
|
|
|
2
|
|
|
|
|
95
|
|
|
9
|
2
|
|
|
2
|
|
17
|
use Moo::_Utils qw(_install_modifier); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
153
|
|
|
10
|
2
|
|
|
2
|
|
14
|
use Carp (); |
|
|
2
|
|
|
|
|
21
|
|
|
|
2
|
|
|
|
|
634
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
|
13
|
6
|
|
|
6
|
|
4732
|
my $class = shift; |
|
14
|
6
|
|
|
|
|
16
|
my $target = caller; |
|
15
|
6
|
|
|
|
|
10
|
my $late; |
|
16
|
6
|
|
|
|
|
14
|
for my $arg (@_) { |
|
17
|
1
|
50
|
|
|
|
4
|
if ($arg eq '-late') { |
|
18
|
1
|
|
|
|
|
3
|
$late = 1; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
else { |
|
21
|
0
|
|
|
|
|
0
|
Carp::croak("Unknown option $arg"); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
} |
|
24
|
6
|
50
|
|
|
|
24
|
unless ( Moo->is_class($target) ) { |
|
25
|
0
|
|
|
|
|
0
|
Carp::croak("MooX::StrictConstructor can only be used on Moo classes."); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
51
|
_apply_role($target, $late); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
_install_modifier($target, 'after', 'extends', sub { |
|
31
|
2
|
|
|
2
|
|
227385
|
_apply_role($target, $late); |
|
32
|
6
|
|
|
|
|
6935
|
}); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _apply_role { |
|
36
|
8
|
|
|
8
|
|
16
|
my ($target, $late) = @_; |
|
37
|
8
|
|
|
|
|
27
|
my $con = Moo->_constructor_maker_for($target); ## no critic (Subroutines::ProtectPrivateSubs) |
|
38
|
8
|
100
|
|
|
|
28757
|
my $role = $late ? 'MooX::StrictConstructor::Role::Constructor::Late' |
|
39
|
|
|
|
|
|
|
: 'MooX::StrictConstructor::Role::Constructor'; |
|
40
|
8
|
100
|
|
|
|
31
|
Moo::Role->apply_roles_to_object($con, $role) |
|
41
|
|
|
|
|
|
|
unless Moo::Role::does_role($con, $role); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |