| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PITA::XML::Request; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
PITA::XML::Request - A request for the testing of a software package |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Create a request specification |
|
12
|
|
|
|
|
|
|
my $dist = PITA::XML::Request->new( |
|
13
|
|
|
|
|
|
|
scheme => 'perl5', |
|
14
|
|
|
|
|
|
|
distname => 'PITA-XML', |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# The package to test |
|
17
|
|
|
|
|
|
|
file => PITA::XML::File->new( |
|
18
|
|
|
|
|
|
|
filename => 'Foo-Bar-0.01.tar.gz', |
|
19
|
|
|
|
|
|
|
digest => 'MD5.0123456789ABCDEF0123456789ABCDEF', |
|
20
|
|
|
|
|
|
|
), |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Optional fields for repository-based requests |
|
23
|
|
|
|
|
|
|
authority => 'cpan', |
|
24
|
|
|
|
|
|
|
authpath => '/id/A/AD/ADAMK/Foo-Bar-0.01.tar.gz', |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
C is an object for holding information about |
|
30
|
|
|
|
|
|
|
a request for a distribution to be tested. It is created most often |
|
31
|
|
|
|
|
|
|
as part of the parsing of a L XML file. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
It holds the testing scheme, name of the distribition, file information, |
|
34
|
|
|
|
|
|
|
and authority information (if the distribution was sourced from a |
|
35
|
|
|
|
|
|
|
repository such as CPAN) |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
10
|
|
|
10
|
|
181
|
use 5.006; |
|
|
10
|
|
|
|
|
33
|
|
|
|
10
|
|
|
|
|
388
|
|
|
42
|
10
|
|
|
10
|
|
50
|
use strict; |
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
276
|
|
|
43
|
10
|
|
|
10
|
|
51
|
use Carp (); |
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
142
|
|
|
44
|
10
|
|
|
10
|
|
61
|
use File::Spec (); |
|
|
10
|
|
|
|
|
20
|
|
|
|
10
|
|
|
|
|
166
|
|
|
45
|
10
|
|
|
10
|
|
89
|
use File::Basename (); |
|
|
10
|
|
|
|
|
23
|
|
|
|
10
|
|
|
|
|
152
|
|
|
46
|
10
|
|
|
10
|
|
9147
|
use Config::Tiny (); |
|
|
10
|
|
|
|
|
12146
|
|
|
|
10
|
|
|
|
|
250
|
|
|
47
|
10
|
|
|
10
|
|
66
|
use Params::Util qw{ _INSTANCE _STRING }; |
|
|
10
|
|
|
|
|
19
|
|
|
|
10
|
|
|
|
|
585
|
|
|
48
|
10
|
|
|
10
|
|
56
|
use PITA::XML::Storable (); |
|
|
10
|
|
|
|
|
18
|
|
|
|
10
|
|
|
|
|
193
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
10
|
|
|
10
|
|
51
|
use vars qw{$VERSION @ISA}; |
|
|
10
|
|
|
|
|
19
|
|
|
|
10
|
|
|
|
|
617
|
|
|
51
|
|
|
|
|
|
|
BEGIN { |
|
52
|
10
|
|
|
10
|
|
22
|
$VERSION = '0.52'; |
|
53
|
10
|
|
|
|
|
10808
|
@ISA = 'PITA::XML::Storable'; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
3
|
|
|
3
|
0
|
24
|
sub xml_entity { 'request' } |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
##################################################################### |
|
63
|
|
|
|
|
|
|
# Constructor and Accessors |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub new { |
|
66
|
20
|
|
|
20
|
0
|
1124
|
my $class = shift; |
|
67
|
20
|
|
|
|
|
4293
|
my $self = bless { @_ }, $class; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Check the object |
|
70
|
20
|
|
|
|
|
59
|
$self->_init; |
|
71
|
|
|
|
|
|
|
|
|
72
|
10
|
|
|
|
|
45
|
$self; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Format-check the parameters |
|
76
|
|
|
|
|
|
|
sub _init { |
|
77
|
24
|
|
|
24
|
|
38
|
my $self = shift; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Check the id, if it has one |
|
80
|
24
|
100
|
|
|
|
69
|
if ( defined $self->id ) { |
|
81
|
2
|
50
|
|
|
|
9
|
unless ( PITA::XML->_GUID($self->id) ) { |
|
82
|
0
|
|
|
|
|
0
|
Carp::croak('Invalid id value format'); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Check the scheme |
|
87
|
24
|
100
|
|
|
|
78
|
unless ( PITA::XML->_SCHEME($self->scheme) ) { |
|
88
|
3
|
|
|
|
|
647
|
Carp::croak('Missing, invalid or unsupported scheme'); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Arbitrarily apply the normal standard for distributions |
|
92
|
|
|
|
|
|
|
### Might need to change this down the line |
|
93
|
21
|
100
|
|
|
|
136
|
unless ( PITA::XML->_DISTNAME($self->distname) ) { |
|
94
|
2
|
|
|
|
|
326
|
Carp::croak('Missing or invalid distname'); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Check the (required) file |
|
98
|
19
|
100
|
|
|
|
64
|
unless ( _INSTANCE($self->file, 'PITA::XML::File') ) { |
|
99
|
2
|
|
|
|
|
301
|
Carp::croak('Missing or invalid file'); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Is there an authority |
|
103
|
17
|
100
|
|
|
|
658
|
if ( $self->authority ) { |
|
104
|
|
|
|
|
|
|
# Check the authority |
|
105
|
8
|
100
|
|
|
|
26
|
unless ( _STRING($self->authority) ) { |
|
106
|
1
|
|
|
|
|
175
|
Carp::croak('Invalid authority'); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} else { |
|
109
|
9
|
|
|
|
|
27
|
$self->{authority} = ''; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Check the cpanpath |
|
113
|
16
|
100
|
|
|
|
48
|
if ( $self->authpath ) { |
|
114
|
|
|
|
|
|
|
# Check the authpath |
|
115
|
7
|
100
|
|
|
|
20
|
unless ( _STRING($self->authpath) ) { |
|
116
|
1
|
|
|
|
|
145
|
Carp::croak('Invalid authpath'); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} else { |
|
119
|
9
|
|
|
|
|
31
|
$self->{authpath} = ''; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# Authpath and authority are needed together |
|
123
|
15
|
100
|
100
|
|
|
41
|
if ( $self->authpath and ! $self->authority ) { |
|
124
|
1
|
|
|
|
|
164
|
Carp::croak('No authority provided with authpath'); |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
# Authpath and authority are needed together |
|
127
|
14
|
100
|
100
|
|
|
37
|
if ( $self->authority and ! $self->authpath ) { |
|
128
|
1
|
|
|
|
|
172
|
Carp::croak('No authpath provided with authority'); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
13
|
|
|
|
|
31
|
$self; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=pod |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 id |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The C accessor returns the unique identifier of the request, if |
|
139
|
|
|
|
|
|
|
it has one. This should be some form of L string. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Returns the identifier as a string, or C if the request has not |
|
142
|
|
|
|
|
|
|
been assigned an id. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
|
145
|
|
|
|
|
|
|
|
|
146
|
30
|
|
|
30
|
1
|
644
|
sub id { $_[0]->{id} } |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=pod |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 scheme |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
The C accessor returns the name of the testing scheme that the |
|
153
|
|
|
|
|
|
|
distribution is to be tested under. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
In this initial implementation, the following schemes are supported. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over 4 |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item perl5 |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Perl 5 general testing scheme. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Auto-detect the specific sub-scheme (currently either C |
|
164
|
|
|
|
|
|
|
or C) |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item perl5.make |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Traditional Perl 5 testing scheme. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Executes C, C, C, |
|
171
|
|
|
|
|
|
|
C. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item perl5.build |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L Perl 5 testing scheme. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Executes C, C, C, |
|
178
|
|
|
|
|
|
|
C. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item perl6 |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Perl 6 general testing scheme. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Specifics are yet to be determined. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=back |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub scheme { |
|
191
|
41
|
|
|
41
|
1
|
314
|
$_[0]->{scheme}; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=pod |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 distname |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
The C accessor returns the name of the request as a string. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Most often, this would be something like 'Foo-Bar' with a primary focus on |
|
201
|
|
|
|
|
|
|
the class Foo::Bar. |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub distname { |
|
206
|
28
|
|
|
28
|
1
|
2229
|
$_[0]->{distname}; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=pod |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 file |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
The C accessor returns the L that contains the |
|
214
|
|
|
|
|
|
|
package to test. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=cut |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub file { |
|
219
|
31
|
|
|
31
|
1
|
289
|
$_[0]->{file}; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=pod |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head2 authority |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
If present, the C accessor returns the name of the package |
|
227
|
|
|
|
|
|
|
authority. For example, CPAN distributions use the authority C<'cpan'>. |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub authority { |
|
232
|
53
|
|
|
53
|
1
|
2302
|
$_[0]->{authority}; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=pod |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 authpath |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
When testing distributions , the C returns the path for |
|
240
|
|
|
|
|
|
|
the Request file within the CPAN. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
For non-CPAN distributions, returns false (the null string). |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=cut |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub authpath { |
|
247
|
51
|
|
|
51
|
1
|
200
|
$_[0]->{authpath}; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=pod |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 find_file $base |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
The C method takes a file or directory as a param (which |
|
255
|
|
|
|
|
|
|
must exist) and tries to locate the actual file on disk at a location |
|
256
|
|
|
|
|
|
|
within or relative to the passed path. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Returns the merge path to the file (if it exists) or C if not. |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=cut |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub find_file { |
|
263
|
1
|
|
|
1
|
1
|
776
|
my $self = shift; |
|
264
|
1
|
|
|
|
|
3
|
my $path = shift; |
|
265
|
1
|
50
|
|
|
|
39
|
if ( -f $path ) { |
|
266
|
1
|
|
|
|
|
52
|
$path = File::Basename::dirname($path); |
|
267
|
|
|
|
|
|
|
} |
|
268
|
1
|
50
|
|
|
|
15
|
unless ( -d $path ) { |
|
269
|
0
|
|
|
|
|
0
|
Carp::croak("Invalid or non-existant base path"); |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
# Add the filename to the base dir |
|
273
|
1
|
|
|
|
|
5
|
my $file = File::Spec->catfile( $path, $self->file->filename ); |
|
274
|
1
|
50
|
|
|
|
23
|
return -f $file ? $file : undef; |
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
1; |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=pod |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 SUPPORT |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Bugs should be reported via the CPAN bug tracker at |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
L |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
For other issues, contact the author. |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head1 AUTHOR |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE, L |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
L |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
The Perl Image-based Testing Architecture (L) |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
Copyright 2005 - 2013 Adam Kennedy. |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
304
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
307
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |