| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Rope::Factory; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2016
|
use strict; use warnings; |
|
|
4
|
|
|
4
|
|
7
|
|
|
|
4
|
|
|
|
|
169
|
|
|
|
4
|
|
|
|
|
19
|
|
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
202
|
|
|
4
|
4
|
|
|
4
|
|
2105
|
use Factory::Sub; |
|
|
4
|
|
|
|
|
684654
|
|
|
|
4
|
|
|
|
|
19
|
|
|
5
|
4
|
|
|
4
|
|
175
|
use Coerce::Types::Standard; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
43
|
|
|
6
|
4
|
|
|
4
|
|
5302
|
use Rope::Pro; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
183
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my (%PRO); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
|
11
|
4
|
|
|
4
|
|
23
|
%PRO = Rope::Pro->new; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
|
15
|
5
|
|
|
5
|
|
71
|
my ($caller, $pkg, @types) = (scalar caller, @_); |
|
16
|
5
|
50
|
|
|
|
25
|
if (@types) { |
|
17
|
5
|
|
|
|
|
31
|
Coerce::Types::Standard->import::into($caller, @types) |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
$PRO{keyword}($caller, 'factory', sub { |
|
20
|
10
|
|
|
10
|
|
164438
|
my ($name, @factory) = @_; |
|
21
|
10
|
100
|
|
|
|
56
|
my ($meta, $ind, $fact, $exists, $extends) = ( |
|
22
|
|
|
|
|
|
|
Rope->get_meta($caller), |
|
23
|
|
|
|
|
|
|
(! ref $factory[0] ? shift @factory : 0) |
|
24
|
|
|
|
|
|
|
); |
|
25
|
10
|
100
|
|
|
|
44
|
if ($meta->{properties}->{$name}) { |
|
26
|
8
|
100
|
|
|
|
32
|
if ($meta->{properties}->{$name}->{fact}->[$ind]) { |
|
27
|
3
|
|
|
|
|
9
|
$fact = $meta->{properties}->{$name}->{fact}->[$ind]; |
|
28
|
3
|
|
|
|
|
6
|
$exists = 1; |
|
29
|
|
|
|
|
|
|
} else { |
|
30
|
5
|
|
|
|
|
34
|
$fact = Factory::Sub->new(); |
|
31
|
5
|
|
|
|
|
65
|
$extends = 1; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} else { |
|
34
|
2
|
|
|
|
|
24
|
$fact = Factory::Sub->new(); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
10
|
|
|
|
|
57
|
while (@factory) { |
|
37
|
17
|
|
|
|
|
233
|
my ($check, $cb) = (shift(@factory), shift(@factory)); |
|
38
|
17
|
100
|
|
|
|
74
|
if (ref $check eq 'CODE') { |
|
39
|
1
|
50
|
|
|
|
4
|
unshift @factory, $cb if $cb; |
|
40
|
1
|
|
|
|
|
6
|
$fact->add($check); |
|
41
|
|
|
|
|
|
|
} else { |
|
42
|
16
|
|
|
27
|
|
75
|
$fact->add(sub { $_[0]; }, @{$check}, $cb); |
|
|
27
|
|
|
|
|
15169
|
|
|
|
16
|
|
|
|
|
70
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
10
|
100
|
|
|
|
140
|
if ($extends) { |
|
|
|
100
|
|
|
|
|
|
|
46
|
5
|
|
|
|
|
51
|
Rope->clear_property($caller, $name); |
|
47
|
5
|
|
|
|
|
12
|
my $prop = $meta->{properties}->{$name}; |
|
48
|
5
|
|
|
|
|
10
|
push @{$prop->{fact}}, $fact; |
|
|
5
|
|
|
|
|
14
|
|
|
49
|
5
|
|
|
11
|
|
8
|
push @{$prop->{after}}, sub { $fact->(@_) }; |
|
|
5
|
|
|
|
|
37
|
|
|
|
11
|
|
|
|
|
52
|
|
|
50
|
5
|
|
|
|
|
12
|
$caller->property($name, %{$prop}); |
|
|
5
|
|
|
|
|
27
|
|
|
51
|
|
|
|
|
|
|
} elsif (!$exists) { |
|
52
|
|
|
|
|
|
|
$caller->property($name, |
|
53
|
11
|
|
|
11
|
|
58
|
value => sub { $fact->(@_) }, |
|
54
|
2
|
|
|
|
|
51
|
initable => 0, |
|
55
|
|
|
|
|
|
|
enumerable => 0, |
|
56
|
|
|
|
|
|
|
writeable => 0, |
|
57
|
|
|
|
|
|
|
fact => [$fact] |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
5
|
|
|
|
|
5766
|
}); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |