line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Object::Attributes; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
291456
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
6
|
use registry; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
5314
|
use routines; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1599
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# BUILD |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $builders = {}; |
17
|
|
|
|
|
|
|
|
18
|
20
|
|
|
20
|
|
145675
|
fun import($class, @args) { |
|
20
|
|
|
|
|
36
|
|
19
|
20
|
50
|
|
|
|
190
|
my $has = (my $target = caller)->can('has') or return; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
456
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
22
|
1
|
|
|
1
|
|
5
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
79
|
|
23
|
|
|
|
|
|
|
|
24
|
20
|
|
|
|
|
70
|
*{"${target}::has"} = generate([$class, $target], $has); |
|
20
|
|
|
|
|
85
|
|
25
|
|
|
|
|
|
|
|
26
|
20
|
|
|
|
|
1741
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
20
|
|
|
20
|
0
|
37
|
fun generate($info, $orig) { |
|
20
|
|
|
|
|
28
|
|
30
|
|
|
|
|
|
|
# generate "has" keyword |
31
|
|
|
|
|
|
|
|
32
|
20
|
|
|
20
|
|
92
|
return fun(@args) { @_ = options($info, @args); goto $orig }; |
|
20
|
|
|
|
|
1496
|
|
|
20
|
|
|
|
|
31
|
|
|
20
|
|
|
|
|
54
|
|
|
20
|
|
|
|
|
81
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$builders->{new} = fun($info, $name, %opts) { |
36
|
|
|
|
|
|
|
if (delete $opts{new}) { |
37
|
|
|
|
|
|
|
$opts{builder} = "new_${name}"; |
38
|
|
|
|
|
|
|
$opts{lazy} = 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return (%opts); |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$builders->{bld} = fun($info, $name, %opts) { |
45
|
|
|
|
|
|
|
$opts{builder} = delete $opts{bld}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return (%opts); |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$builders->{clr} = fun($info, $name, %opts) { |
51
|
|
|
|
|
|
|
$opts{clearer} = delete $opts{clr}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return (%opts); |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$builders->{crc} = fun($info, $name, %opts) { |
57
|
|
|
|
|
|
|
$opts{coerce} = delete $opts{crc}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return (%opts); |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$builders->{def} = fun($info, $name, %opts) { |
63
|
|
|
|
|
|
|
$opts{default} = delete $opts{def}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return (%opts); |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$builders->{hnd} = fun($info, $name, %opts) { |
69
|
|
|
|
|
|
|
$opts{handles} = delete $opts{hnd}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return (%opts); |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$builders->{isa} = fun($info, $name, %opts) { |
75
|
|
|
|
|
|
|
return (%opts) if ref($opts{isa}); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $registry = registry::access($info->[1]); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return (%opts) if !$registry; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $constraint = $registry->lookup($opts{isa}); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return (%opts) if !$constraint; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$opts{isa} = $constraint; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return (%opts); |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$builders->{lzy} = fun($info, $name, %opts) { |
91
|
|
|
|
|
|
|
$opts{lazy} = delete $opts{lzy}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
return (%opts); |
94
|
|
|
|
|
|
|
}; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$builders->{opt} = fun($info, $name, %opts) { |
97
|
|
|
|
|
|
|
delete $opts{opt}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$opts{required} = 0; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
return (%opts); |
102
|
|
|
|
|
|
|
}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
$builders->{pre} = fun($info, $name, %opts) { |
105
|
|
|
|
|
|
|
$opts{predicate} = delete $opts{pre}; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
return (%opts); |
108
|
|
|
|
|
|
|
}; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$builders->{rdr} = fun($info, $name, %opts) { |
111
|
|
|
|
|
|
|
$opts{reader} = delete $opts{rdr}; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return (%opts); |
114
|
|
|
|
|
|
|
}; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
$builders->{req} = fun($info, $name, %opts) { |
117
|
|
|
|
|
|
|
delete $opts{req}; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$opts{required} = 1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
return (%opts); |
122
|
|
|
|
|
|
|
}; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$builders->{tgr} = fun($info, $name, %opts) { |
125
|
|
|
|
|
|
|
$opts{trigger} = delete $opts{tgr}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
return (%opts); |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$builders->{use} = fun($info, $name, %opts) { |
131
|
|
|
|
|
|
|
if (my $use = delete $opts{use}) { |
132
|
|
|
|
|
|
|
$opts{builder} = $builders->{use_builder}->($info, $name, @$use); |
133
|
|
|
|
|
|
|
$opts{lazy} = 1; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
return (%opts); |
137
|
|
|
|
|
|
|
}; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$builders->{use_builder} = fun($info, $name, $sub, @args) { |
140
|
1
|
|
|
1
|
|
2660
|
return fun($self) { |
|
1
|
|
|
|
|
3
|
|
141
|
1
|
|
|
|
|
5
|
@_ = ($self, @args); |
142
|
|
|
|
|
|
|
|
143
|
1
|
50
|
|
|
|
8
|
my $point = $self->can($sub) or do { |
144
|
0
|
|
|
|
|
0
|
require Carp; |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
0
|
my $class = $info->[1]; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
0
|
Carp::confess("has '$name' cannot 'use' method '$sub' via package '$class'"); |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
20
|
goto $point; |
152
|
|
|
|
|
|
|
}; |
153
|
|
|
|
|
|
|
}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$builders->{wkr} = fun($info, $name, %opts) { |
156
|
|
|
|
|
|
|
$opts{weak_ref} = delete $opts{wkr}; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
return (%opts); |
159
|
|
|
|
|
|
|
}; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$builders->{wrt} = fun($info, $name, %opts) { |
162
|
|
|
|
|
|
|
$opts{writer} = delete $opts{wrt}; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
return (%opts); |
165
|
|
|
|
|
|
|
}; |
166
|
|
|
|
|
|
|
|
167
|
20
|
|
|
20
|
0
|
73
|
fun options($info, $name, %opts) { |
|
20
|
|
|
|
|
32
|
|
168
|
20
|
100
|
|
|
|
51
|
%opts = (is => 'rw') unless %opts; |
169
|
|
|
|
|
|
|
|
170
|
20
|
100
|
|
|
|
58
|
%opts = (%opts, $builders->{new}->($info, $name, %opts)) if defined $opts{new}; |
171
|
20
|
100
|
|
|
|
61
|
%opts = (%opts, $builders->{bld}->($info, $name, %opts)) if defined $opts{bld}; |
172
|
20
|
100
|
|
|
|
62
|
%opts = (%opts, $builders->{clr}->($info, $name, %opts)) if defined $opts{clr}; |
173
|
20
|
100
|
|
|
|
49
|
%opts = (%opts, $builders->{crc}->($info, $name, %opts)) if defined $opts{crc}; |
174
|
20
|
100
|
|
|
|
46
|
%opts = (%opts, $builders->{def}->($info, $name, %opts)) if defined $opts{def}; |
175
|
20
|
100
|
|
|
|
41
|
%opts = (%opts, $builders->{hnd}->($info, $name, %opts)) if defined $opts{hnd}; |
176
|
20
|
100
|
|
|
|
45
|
%opts = (%opts, $builders->{isa}->($info, $name, %opts)) if defined $opts{isa}; |
177
|
20
|
100
|
|
|
|
46
|
%opts = (%opts, $builders->{lzy}->($info, $name, %opts)) if defined $opts{lzy}; |
178
|
20
|
100
|
|
|
|
47
|
%opts = (%opts, $builders->{opt}->($info, $name, %opts)) if defined $opts{opt}; |
179
|
20
|
100
|
|
|
|
43
|
%opts = (%opts, $builders->{pre}->($info, $name, %opts)) if defined $opts{pre}; |
180
|
20
|
100
|
|
|
|
65
|
%opts = (%opts, $builders->{rdr}->($info, $name, %opts)) if defined $opts{rdr}; |
181
|
20
|
100
|
|
|
|
44
|
%opts = (%opts, $builders->{req}->($info, $name, %opts)) if defined $opts{req}; |
182
|
20
|
100
|
|
|
|
48
|
%opts = (%opts, $builders->{tgr}->($info, $name, %opts)) if defined $opts{tgr}; |
183
|
20
|
100
|
|
|
|
38
|
%opts = (%opts, $builders->{use}->($info, $name, %opts)) if defined $opts{use}; |
184
|
20
|
100
|
|
|
|
42
|
%opts = (%opts, $builders->{wkr}->($info, $name, %opts)) if defined $opts{wkr}; |
185
|
20
|
100
|
|
|
|
45
|
%opts = (%opts, $builders->{wrt}->($info, $name, %opts)) if defined $opts{wrt}; |
186
|
|
|
|
|
|
|
|
187
|
20
|
100
|
66
|
|
|
94
|
$name = "+$name" if delete $opts{mod} || delete $opts{modify}; |
188
|
|
|
|
|
|
|
|
189
|
20
|
|
|
|
|
92
|
return ($name, %opts); |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
1; |