line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::BaseRegistry; |
2
|
|
|
|
|
|
|
|
3
|
69
|
|
|
69
|
|
18587
|
use App::RecordStream::Site; |
|
69
|
|
|
|
|
195
|
|
|
69
|
|
|
|
|
2111
|
|
4
|
|
|
|
|
|
|
|
5
|
69
|
|
|
69
|
|
506
|
use strict; |
|
69
|
|
|
|
|
152
|
|
|
69
|
|
|
|
|
1421
|
|
6
|
69
|
|
|
69
|
|
381
|
use warnings; |
|
69
|
|
|
|
|
150
|
|
|
69
|
|
|
|
|
1744
|
|
7
|
69
|
|
|
69
|
|
21659
|
use Module::Pluggable::Object; |
|
69
|
|
|
|
|
534385
|
|
|
69
|
|
|
|
|
45747
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub load_implementations |
10
|
|
|
|
|
|
|
{ |
11
|
46
|
|
|
46
|
0
|
297
|
my $registry_class = shift; |
12
|
|
|
|
|
|
|
|
13
|
46
|
|
|
|
|
228
|
my $subtree = $registry_class->subtree(); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# include sites, overriding lower priority with higher priority |
16
|
46
|
|
|
|
|
285
|
App::RecordStream::Site::bootstrap(); |
17
|
46
|
|
|
|
|
278
|
my @sites = sort { $a->{'priority'} <=> $b->{'priority'} } App::RecordStream::Site::list_sites(); |
|
0
|
|
|
|
|
0
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Module::Pluggable::Object->new( |
20
|
|
|
|
|
|
|
require => 1, |
21
|
|
|
|
|
|
|
search_path => [ |
22
|
|
|
|
|
|
|
"App::RecordStream::$subtree", |
23
|
46
|
|
|
|
|
569
|
map { "$_->{path}::$subtree" } @sites |
|
0
|
|
|
|
|
0
|
|
24
|
|
|
|
|
|
|
], |
25
|
|
|
|
|
|
|
)->plugins; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
my %class_registry; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub register_implementation |
32
|
|
|
|
|
|
|
{ |
33
|
332
|
|
|
332
|
0
|
673
|
my $registry_class = shift; |
34
|
332
|
|
|
|
|
526
|
my $name = shift; |
35
|
332
|
|
|
|
|
505
|
my $class = shift; |
36
|
|
|
|
|
|
|
|
37
|
332
|
|
|
|
|
1172
|
$class_registry{$registry_class}->{$name} = $class; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub parse_single_nameless_implementation |
41
|
|
|
|
|
|
|
{ |
42
|
38
|
|
|
38
|
0
|
89
|
my $registry_class = shift; |
43
|
38
|
|
|
|
|
85
|
my $spec = shift; |
44
|
|
|
|
|
|
|
|
45
|
38
|
|
|
|
|
138
|
my @spec = split(/,/, $spec); |
46
|
|
|
|
|
|
|
|
47
|
38
|
50
|
|
|
|
136
|
if(!@spec) |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
0
|
die "Bad " . $registry_class->typename() . " spec: " . $spec . "\n"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
38
|
|
|
|
|
108
|
my $aggr_name = shift(@spec); |
53
|
38
|
|
|
|
|
146
|
my $class = $class_registry{$registry_class}->{$aggr_name}; |
54
|
38
|
50
|
|
|
|
122
|
if(!$class) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
0
|
die "Bad " . $registry_class->typename() . ": " . $aggr_name . "\n"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
38
|
|
|
|
|
325
|
my $argct = $class->argct(); |
60
|
38
|
100
|
|
|
|
131
|
if(!ref($argct)) |
61
|
|
|
|
|
|
|
{ |
62
|
36
|
|
|
|
|
114
|
$argct = [$argct]; |
63
|
|
|
|
|
|
|
} |
64
|
38
|
50
|
|
|
|
101
|
if(!(grep { $_ == @spec } @$argct)) |
|
40
|
|
|
|
|
190
|
|
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
0
|
print $class->long_usage(); |
67
|
0
|
|
|
|
|
0
|
exit 1; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
38
|
|
|
|
|
225
|
return $class->new(@spec); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub list_implementations |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
0
|
0
|
0
|
my $registry_class = shift; |
76
|
0
|
|
0
|
|
|
0
|
my $prefix = shift || ''; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
0
|
my %reverse; |
79
|
|
|
|
|
|
|
my @classes; |
80
|
0
|
|
|
|
|
0
|
for my $name (sort(keys(%{$class_registry{$registry_class}}))) |
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
|
|
0
|
my $class = $class_registry{$registry_class}->{$name}; |
83
|
0
|
|
|
|
|
0
|
my $ar = $reverse{$class}; |
84
|
0
|
0
|
|
|
|
0
|
if(!$ar) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
0
|
$reverse{$class} = $ar = []; |
87
|
0
|
|
|
|
|
0
|
push @classes, $class; |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
0
|
push @$ar, $name; |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
0
|
my $ret = ""; |
92
|
0
|
|
|
|
|
0
|
for my $class (@classes) |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
|
|
0
|
my $usage = $class->short_usage(); |
95
|
0
|
|
|
|
|
0
|
$ret .= $prefix . join(", ", @{$reverse{$class}}) . ": " . $usage . "\n"; |
|
0
|
|
|
|
|
0
|
|
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
0
|
return $ret; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub show_implementation |
101
|
|
|
|
|
|
|
{ |
102
|
0
|
|
|
0
|
0
|
0
|
my $registry_class = shift; |
103
|
0
|
|
|
|
|
0
|
my $name = shift; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
my $class = $class_registry{$registry_class}->{$name}; |
106
|
0
|
0
|
|
|
|
0
|
if(!$class) |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
|
|
0
|
print "Bad " . $registry_class->typename() . ": " . $name . "\n"; |
109
|
0
|
|
|
|
|
0
|
exit 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
0
|
print $class->long_usage(); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# subclasses may override these all if they wish |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub subtree |
119
|
|
|
|
|
|
|
{ |
120
|
46
|
|
|
46
|
0
|
114
|
my $registry_class = shift; |
121
|
|
|
|
|
|
|
|
122
|
46
|
|
|
|
|
214
|
return $registry_class->begin_sentence_typename(); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub begin_sentence_typename |
126
|
|
|
|
|
|
|
{ |
127
|
46
|
|
|
46
|
0
|
119
|
my $registry_class = shift; |
128
|
|
|
|
|
|
|
|
129
|
46
|
|
|
|
|
245
|
my $t = $registry_class->typename(); |
130
|
|
|
|
|
|
|
|
131
|
46
|
|
|
|
|
309
|
return uc(substr($t, 0, 1)) . substr($t, 1); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub typename |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
|
0
|
0
|
|
my $registry_class = shift; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
die "BaseRegistry subclass $registry_class did not implement typename()"; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |