| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
7
|
|
|
7
|
|
500
|
use 5.006; # our |
|
|
7
|
|
|
|
|
20
|
|
|
2
|
7
|
|
|
7
|
|
26
|
use strict; |
|
|
7
|
|
|
|
|
9
|
|
|
|
7
|
|
|
|
|
138
|
|
|
3
|
7
|
|
|
7
|
|
23
|
use warnings; |
|
|
7
|
|
|
|
|
7
|
|
|
|
7
|
|
|
|
|
476
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Search::GIN::Extract::ClassMap::Types; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Types for Search::GIN::Extract::ClassMap, mostly for coercing. |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.000003'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
|
12
|
|
|
|
|
|
|
|
|
13
|
7
|
|
|
7
|
|
2973
|
use MooseX::Types::Moose qw( :all ); |
|
|
7
|
|
|
|
|
642971
|
|
|
|
7
|
|
|
|
|
65
|
|
|
14
|
7
|
|
|
|
|
61
|
use MooseX::Types -declare => [ |
|
15
|
|
|
|
|
|
|
qw[ |
|
16
|
|
|
|
|
|
|
IsaClassMap |
|
17
|
|
|
|
|
|
|
DoesClassMap |
|
18
|
|
|
|
|
|
|
LikeClassMap |
|
19
|
|
|
|
|
|
|
Extractor |
|
20
|
|
|
|
|
|
|
CoercedClassMap |
|
21
|
|
|
|
|
|
|
], |
|
22
|
7
|
|
|
7
|
|
38001
|
]; |
|
|
7
|
|
|
|
|
14
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitCallsToUndeclaredSubs) |
|
37
|
|
|
|
|
|
|
class_type IsaClassMap, { class => 'Search::GIN::Extract::ClassMap::Isa' }; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
coerce IsaClassMap, from HashRef, via { |
|
40
|
|
|
|
|
|
|
require Search::GIN::Extract::ClassMap::Isa; |
|
41
|
|
|
|
|
|
|
'Search::GIN::Extract::ClassMap::Isa'->new( classmap => $_ ); |
|
42
|
|
|
|
|
|
|
}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
class_type DoesClassMap, { class => 'Search::GIN::Extract::ClassMap::Does' }; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
coerce DoesClassMap, from HashRef, via { |
|
59
|
|
|
|
|
|
|
require Search::GIN::Extract::ClassMap::Does; |
|
60
|
|
|
|
|
|
|
'Search::GIN::Extract::ClassMap::Does'->new( classmap => $_ ); |
|
61
|
|
|
|
|
|
|
}; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
class_type LikeClassMap, { class => 'Search::GIN::Extract::ClassMap::Like' }; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
coerce LikeClassMap, from HashRef, via { |
|
78
|
|
|
|
|
|
|
require Search::GIN::Extract::ClassMap::Like; |
|
79
|
|
|
|
|
|
|
'Search::GIN::Extract::ClassMap::Like'->new( classmap => $_ ); |
|
80
|
|
|
|
|
|
|
}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
subtype Extractor, as Object, where { |
|
103
|
|
|
|
|
|
|
$_->does('Search::GIN::Extract') |
|
104
|
|
|
|
|
|
|
or $_->isa('Search::GIN::Extract'); |
|
105
|
|
|
|
|
|
|
}; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
coerce Extractor, from ArrayRef [Str], via { |
|
108
|
|
|
|
|
|
|
require Search::GIN::Extract::Attributes; |
|
109
|
|
|
|
|
|
|
Search::GIN::Extract::Attributes->new( attributes => $_ ); |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
}; |
|
112
|
|
|
|
|
|
|
coerce Extractor, from CodeRef, via { |
|
113
|
|
|
|
|
|
|
require Search::GIN::Extract::Callback; |
|
114
|
|
|
|
|
|
|
Search::GIN::Extract::Callback->new( extract => $_ ); |
|
115
|
|
|
|
|
|
|
}; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
subtype CoercedClassMap, as HashRef, where { |
|
135
|
|
|
|
|
|
|
for my $v ( values %{$_} ) { |
|
136
|
|
|
|
|
|
|
return unless is_Extractor($v); |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
return 1; |
|
139
|
|
|
|
|
|
|
}, message { |
|
140
|
|
|
|
|
|
|
for my $k ( keys %{$_} ) { |
|
141
|
|
|
|
|
|
|
next if is_Extractor( $_->{$k} ); |
|
142
|
|
|
|
|
|
|
return "Key $k in the hash expected Search::GIN::Extract implementation"; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
}; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
coerce CoercedClassMap, from HashRef, via { |
|
147
|
|
|
|
|
|
|
my $newhashref = {}; |
|
148
|
|
|
|
|
|
|
my $old = $_; |
|
149
|
|
|
|
|
|
|
for my $key ( keys %{$old} ) { |
|
150
|
|
|
|
|
|
|
$newhashref->{$key} = to_Extractor( $old->{$key} ); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
return $newhashref; |
|
153
|
|
|
|
|
|
|
}; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
__END__ |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=pod |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=encoding UTF-8 |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 NAME |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Search::GIN::Extract::ClassMap::Types - Types for Search::GIN::Extract::ClassMap, mostly for coercing. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 VERSION |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
version 1.000003 |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 TYPES |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 C<IsaClassMap> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=over 4 |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item C<class_type> : L<< C<::ClassMap::Isa>|Search::GIN::Extract::ClassMap::Isa >> |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item C<coerces_from>: C<HashRef> |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 C<DoesClassMap> |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over 4 |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item C<class_type>: L<< C<::ClassMap::Does>|Search::GIN::Extract::ClassMap::Does >> |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item coerces from: C<HashRef> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 C<LikeClassMap> |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over 4 |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item C<class_type>: L<< C<::ClassMap::Like>|Search::GIN::Extract::ClassMap::Like >> |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item coerces from: C<HashRef> |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=back |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 C<Extractor> |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Mostly here to identify things that derive from L<< C<Search::GIN::Extract>|Search::GIN::Extract >> |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=over 4 |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item C<subtype>: C<Object> |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item coerces from: C<ArrayRef[ Str ]> |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Coerces into a L<< C<::Extract::Attributes>|Search::GIN::Extract::Attributes >> instance. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item coerces from: C<CodeRef> |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Coerces into a L<< C<::Extract::Callback>|Search::GIN::Extract::Callback >> instance. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=back |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head2 C<CoercedClassMap> |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This is here to implement a ( somewhat hackish ) semi-deep recursive coercion. |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Ensures all keys are of type L</Extractor> in order to be a valid C<HashRef>, |
|
226
|
|
|
|
|
|
|
and coerces to L</Extractor>'s where possible. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=over 4 |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item C<subtype>: C<HashRef[ Extractor ]> |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item coerces from: C<HashRef[ coerce Extractor ]> |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 AUTHOR |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
245
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |