| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooX::ClassAttribute; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
169570
|
use 5.008; |
|
|
5
|
|
|
|
|
19
|
|
|
|
5
|
|
|
|
|
218
|
|
|
4
|
5
|
|
|
5
|
|
27
|
use strict; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
219
|
|
|
5
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
230
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
5
|
|
|
5
|
|
9
|
$MooX::ClassAttribute::AUTHORITY = 'cpan:TOBYINK'; |
|
9
|
5
|
|
|
|
|
85
|
$MooX::ClassAttribute::VERSION = '0.011'; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
32
|
use Carp; |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
418
|
|
|
13
|
5
|
|
|
5
|
|
940
|
use Moo (); |
|
|
5
|
|
|
|
|
3177
|
|
|
|
5
|
|
|
|
|
91
|
|
|
14
|
5
|
|
|
5
|
|
1898
|
use Moo::Role (); |
|
|
5
|
|
|
|
|
23645
|
|
|
|
5
|
|
|
|
|
135
|
|
|
15
|
5
|
|
|
5
|
|
2412
|
use MooX::CaptainHook qw( on_application on_inflation is_role ); |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
71
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
|
2104
|
BEGIN { *ROLE = \%Role::Tiny::INFO } |
|
18
|
|
|
|
|
|
|
our %ROLE; |
|
19
|
5
|
|
|
5
|
|
246
|
BEGIN { *CLASS = \%Moo::MAKERS } |
|
20
|
|
|
|
|
|
|
our %CLASS; |
|
21
|
|
|
|
|
|
|
our %ATTRIBUTES; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub import |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
10
|
|
|
10
|
|
5007
|
my $me = shift; |
|
26
|
10
|
|
|
|
|
23
|
my $target = caller; |
|
27
|
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
13
|
my $install_tracked; |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
5
|
|
|
5
|
|
34
|
no warnings; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
2187
|
|
|
|
10
|
|
|
|
|
11
|
|
|
31
|
10
|
100
|
|
|
|
34
|
if ($CLASS{$target}) |
|
|
|
50
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
|
33
|
6
|
|
|
|
|
15
|
$install_tracked = \&Moo::_install_tracked; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
elsif ($ROLE{$target}) |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
4
|
|
|
|
|
7
|
$install_tracked = \&Moo::Role::_install_tracked; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
else |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
0
|
|
|
|
|
0
|
croak "MooX::ClassAttribute applied to a non-Moo package" |
|
42
|
|
|
|
|
|
|
. "(need: use Moo or use Moo::Role)"; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
10
|
|
|
|
|
36
|
my $is_role = is_role($target); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$install_tracked->( |
|
49
|
|
|
|
|
|
|
$target, class_has => sub |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
7
|
|
|
7
|
|
2377
|
my ($proto, %spec) = @_; |
|
52
|
7
|
50
|
|
|
|
32
|
for my $name (ref $proto ? @$proto : $proto) |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
7
|
|
|
|
|
31
|
my $spec = +{ %spec }; # shallow clone |
|
55
|
7
|
100
|
|
|
|
58
|
$is_role |
|
56
|
|
|
|
|
|
|
? $me->_process_for_role($target, $name, $spec) |
|
57
|
|
|
|
|
|
|
: $me->_class_accessor_maker_for($target)->generate_method($target, $name, $spec); |
|
58
|
7
|
|
50
|
|
|
21
|
push @{$ATTRIBUTES{$target}||=[]}, $name, $spec; |
|
|
7
|
|
|
|
|
54
|
|
|
59
|
|
|
|
|
|
|
} |
|
60
|
7
|
|
|
|
|
28
|
return; |
|
61
|
|
|
|
|
|
|
}, |
|
62
|
10
|
|
|
|
|
66
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
10
|
|
|
|
|
276
|
$me->_setup_inflation($target); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _process_for_role |
|
68
|
|
|
|
|
|
|
{ |
|
69
|
3
|
|
|
3
|
|
7
|
my ($me, $target, $name, $spec) = @_; |
|
70
|
|
|
|
|
|
|
on_application { |
|
71
|
3
|
|
|
3
|
|
4
|
my $applied_to = $_; |
|
72
|
3
|
|
|
|
|
12
|
$me |
|
73
|
|
|
|
|
|
|
-> _class_accessor_maker_for($applied_to) |
|
74
|
|
|
|
|
|
|
-> generate_method($applied_to, $name, $spec); |
|
75
|
3
|
|
|
|
|
25
|
} $target; |
|
76
|
3
|
|
|
|
|
14
|
'Moo::Role'->_maybe_reset_handlemoose($target); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _class_accessor_maker_for |
|
80
|
|
|
|
|
|
|
{ |
|
81
|
7
|
|
|
7
|
|
14
|
my ($me, $target) = @_; |
|
82
|
7
|
|
33
|
|
|
41
|
$CLASS{$target}{class_accessor} ||= do { |
|
83
|
7
|
|
|
|
|
2334
|
require Method::Generate::ClassAccessor; |
|
84
|
7
|
|
|
|
|
65
|
'Method::Generate::ClassAccessor'->new; |
|
85
|
|
|
|
|
|
|
}; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _setup_inflation |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
10
|
|
|
10
|
|
15
|
my ($me, $target) = @_; |
|
91
|
|
|
|
|
|
|
on_inflation { |
|
92
|
0
|
|
|
0
|
|
|
require MooX::ClassAttribute::HandleMoose; |
|
93
|
0
|
|
|
|
|
|
$me->_on_inflation($target, @_) |
|
94
|
10
|
|
|
|
|
58
|
} $target; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |