line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Data::Split::Backend::Hash; |
2
|
|
|
|
|
|
|
$Test::Data::Split::Backend::Hash::VERSION = '0.2.2'; |
3
|
3
|
|
|
3
|
|
25466
|
use strict; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
79
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
936
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new |
8
|
|
|
|
|
|
|
{ |
9
|
2
|
|
|
2
|
1
|
3501
|
my $class = shift; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
|
|
6
|
my $self = bless {}, $class; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
13
|
$self->_init(@_); |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
5
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _hash |
19
|
|
|
|
|
|
|
{ |
20
|
13
|
|
|
13
|
|
28
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
13
|
100
|
|
|
|
30
|
if (@_) |
23
|
|
|
|
|
|
|
{ |
24
|
2
|
|
|
|
|
9
|
$self->{_hash} = shift; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
13
|
|
|
|
|
46
|
return $self->{_hash}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _init |
31
|
|
|
|
|
|
|
{ |
32
|
2
|
|
|
2
|
|
6
|
my ( $self, $args ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
10
|
$self->_hash( scalar( $self->get_hash() ) ); |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
4
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub list_ids |
40
|
|
|
|
|
|
|
{ |
41
|
4
|
|
|
4
|
1
|
16
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
7
|
my @keys = keys( %{ $self->_hash } ); |
|
4
|
|
|
|
|
8
|
|
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
963
|
require List::MoreUtils; |
46
|
|
|
|
|
|
|
|
47
|
4
|
50
|
|
14
|
|
14734
|
if ( List::MoreUtils::notall( sub { /\A[A-Za-z_\-0-9]{1,80}\z/ }, @keys ) ) |
|
14
|
|
|
|
|
45
|
|
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
0
|
die |
50
|
|
|
|
|
|
|
"Invalid key in hash reference. All keys must be alphanumeric plus underscores and dashes."; |
51
|
|
|
|
|
|
|
} |
52
|
4
|
|
|
|
|
22
|
return [ sort { $a cmp $b } @keys ]; |
|
12
|
|
|
|
|
40
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub lookup_data |
56
|
|
|
|
|
|
|
{ |
57
|
7
|
|
|
7
|
1
|
9613
|
my ( $self, $id ) = @_; |
58
|
|
|
|
|
|
|
|
59
|
7
|
|
|
|
|
17
|
return $self->_hash->{$id}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=pod |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=encoding UTF-8 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Test::Data::Split::Backend::Hash - hash backend. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
version 0.2.2 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package DataSplitHashTest; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use strict; |
83
|
|
|
|
|
|
|
use warnings; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
use parent 'Test::Data::Split::Backend::Hash'; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my %hash = |
88
|
|
|
|
|
|
|
( |
89
|
|
|
|
|
|
|
a => { more => "Hello"}, |
90
|
|
|
|
|
|
|
b => { more => "Jack"}, |
91
|
|
|
|
|
|
|
c => { more => "Sophie"}, |
92
|
|
|
|
|
|
|
d => { more => "Danny"}, |
93
|
|
|
|
|
|
|
'e100_99' => { more => "Zebra"}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub get_hash |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
return \%hash; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is a hash backend for L<Test::Data::Split> . |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 METHODS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 new() |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
For internal use. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 $obj->lookup_data($id) |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Looks up the data with the ID $id. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 $obj->list_ids() |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Lists the IDs - needed by Test::Data::Split; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 $obj->get_hash() |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This method should be implemented and return a hash reference to the |
124
|
|
|
|
|
|
|
keys/values of the data. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SUPPORT |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 Websites |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The following websites have more information about this module, and may be of help to you. As always, |
133
|
|
|
|
|
|
|
in addition to those websites please use your favorite search engine to discover more resources. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over 4 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
MetaCPAN |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
A modern, open-source CPAN search engine, useful to view POD in HTML format. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L<https://metacpan.org/release/Test-Data-Split> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
RT: CPAN's Bug Tracker |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Data-Split> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
CPANTS |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L<http://cpants.cpanauthors.org/dist/Test-Data-Split> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
CPAN Testers |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L<http://www.cpantesters.org/distro/T/Test-Data-Split> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
CPAN Testers Matrix |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L<http://matrix.cpantesters.org/?dist=Test-Data-Split> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
CPAN Testers Dependencies |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
L<http://deps.cpantesters.org/?module=Test::Data::Split> |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=back |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Please report any bugs or feature requests by email to C<bug-test-data-split at rt.cpan.org>, or through |
190
|
|
|
|
|
|
|
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Test-Data-Split>. You will be automatically notified of any |
191
|
|
|
|
|
|
|
progress on the request by the system. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 Source Code |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
The code is open to the world, and available for you to hack on. Please feel free to browse it and play |
196
|
|
|
|
|
|
|
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull |
197
|
|
|
|
|
|
|
from your repository :) |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
L<https://github.com/shlomif/perl-Test-Data-Split> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
git clone git://github.com/shlomif/perl-Test-Data-Split.git |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 AUTHOR |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Shlomi Fish <shlomif@cpan.org> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 BUGS |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
210
|
|
|
|
|
|
|
L<https://github.com/shlomif/perl-Test-Data-Split/issues> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
213
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
214
|
|
|
|
|
|
|
feature. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Shlomi Fish. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
This is free software, licensed under: |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
The MIT (X11) License |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |