File Coverage

blib/lib/CPAN/Perl/Releases.pm
Criterion Covered Total %
statement 52 52 100.0
branch 23 26 88.4
condition 12 16 75.0
subroutine 8 8 100.0
pod 3 3 100.0
total 98 105 93.3


line stmt bran cond sub pod time code
1             package CPAN::Perl::Releases;
2             $CPAN::Perl::Releases::VERSION = '5.20230720';
3             #ABSTRACT: Mapping Perl releases on CPAN to the location of the tarballs
4              
5 2     2   136016 use strict;
  2         21  
  2         58  
6 2     2   11 use warnings;
  2         4  
  2         54  
7 2     2   10 use vars qw[@ISA @EXPORT_OK];
  2         4  
  2         138  
8              
9 2     2   14 use Exporter;
  2         4  
  2         3645  
10              
11             @ISA = qw(Exporter);
12             @EXPORT_OK = qw(perl_tarballs perl_versions perl_pumpkins);
13              
14             # Data gathered from using findlinks.pl script in this dists tools/
15             # directory, run over the src/5.0 of a local CPAN mirror.
16             our $cache = { };
17             our $data =
18             {
19             "5.004" => { id => 'CHIPS' },
20             "5.004_01" => { id => 'TIMB' },
21             "5.004_02" => { id => 'TIMB' },
22             "5.004_03" => { id => 'TIMB' },
23             "5.004_04" => { id => 'TIMB' },
24             "5.004_05" => { id => 'CHIPS' },
25             "5.005" => { id => 'GSAR' },
26             "5.005_01" => { id => 'GSAR' },
27             "5.005_02" => { id => 'GSAR' },
28             "5.005_03" => { id => 'GBARR' },
29             "5.005_04" => { id => 'LBROCARD' },
30             "5.6.0" => { id => 'GSAR' },
31             "5.6.1-TRIAL1" => { id => 'GSAR' },
32             "5.6.1-TRIAL2" => { id => 'GSAR' },
33             "5.6.1-TRIAL3" => { id => 'GSAR' },
34             "5.6.1" => { id => 'GSAR' },
35             "5.6.2" => { id => 'RGARCIA' },
36             "5.7.0" => { id => 'JHI' },
37             "5.7.2" => { id => 'JHI' },
38             "5.7.3" => { id => 'JHI' },
39             "5.8.0" => { id => 'JHI' },
40             "5.8.1" => { id => 'JHI' },
41             "5.8.2" => { id => 'NWCLARK' },
42             "5.8.3" => { id => 'NWCLARK' },
43             "5.8.4" => { id => 'NWCLARK' },
44             "5.8.5" => { id => 'NWCLARK' },
45             "5.8.6" => { id => 'NWCLARK' },
46             "5.8.7" => { id => 'NWCLARK' },
47             "5.8.8" => { id => 'NWCLARK' },
48             "5.8.9" => { id => 'NWCLARK' },
49             "5.9.0" => { id => 'HVDS' },
50             "5.9.1" => { id => 'RGARCIA' },
51             "5.9.2" => { id => 'RGARCIA' },
52             "5.9.3" => { id => 'RGARCIA' },
53             "5.9.4" => { id => 'RGARCIA' },
54             "5.9.5" => { id => 'RGARCIA' },
55             "5.10.0" => { id => 'RGARCIA' },
56             "5.10.1" => { id => 'DAPM' },
57             "5.11.0" => { id => 'JESSE' },
58             "5.11.1" => { id => 'JESSE' },
59             "5.11.2" => { id => 'LBROCARD' },
60             "5.11.3" => { id => 'JESSE' },
61             "5.11.5" => { id => 'SHAY' },
62             "5.12.0" => { id => 'JESSE' },
63             "5.12.1" => { id => 'JESSE' },
64             "5.12.2" => { id => 'JESSE' },
65             "5.12.3" => { id => 'RJBS' },
66             "5.12.4" => { id => 'LBROCARD' },
67             "5.12.5" => { id => 'DOM' },
68             "5.13.0" => { id => 'LBROCARD' },
69             "5.13.2" => { id => 'MSTROUT' },
70             "5.13.3" => { id => 'DAGOLDEN' },
71             "5.13.4" => { id => 'FLORA' },
72             "5.13.5" => { id => 'SHAY' },
73             "5.13.6" => { id => 'MIYAGAWA' },
74             "5.13.7" => { id => 'BINGOS' },
75             "5.13.8" => { id => 'ZEFRAM' },
76             "5.13.9" => { id => 'JESSE' },
77             "5.13.10" => { id => 'AVAR' },
78             "5.13.11" => { id => 'FLORA' },
79             "5.14.0" => { id => 'JESSE' },
80             "5.14.1" => { id => 'JESSE' },
81             "5.14.2-RC1" => { id => 'FLORA' },
82             "5.14.2" => { id => 'FLORA' },
83             "5.14.3" => { id => 'DOM' },
84             "5.14.4-RC1" => { id => 'DAPM' },
85             "5.14.4-RC2" => { id => 'DAPM' },
86             "5.14.4" => { id => 'DAPM' },
87             "5.15.0" => { id => 'DAGOLDEN' },
88             "5.15.1" => { id => 'ZEFRAM' },
89             "5.15.3" => { id => 'STEVAN' },
90             "5.15.4" => { id => 'FLORA' },
91             "5.15.5" => { id => 'SHAY' },
92             "5.15.6" => { id => 'DROLSKY' },
93             "5.15.7" => { id => 'BINGOS' },
94             "5.15.9" => { id => 'ABIGAIL' },
95             "5.16.0" => { id => 'RJBS' },
96             "5.16.1" => { id => 'RJBS' },
97             "5.16.2" => { id => 'RJBS' },
98             "5.16.3" => { id => 'RJBS' },
99             "5.17.0" => { id => 'ZEFRAM' },
100             "5.17.1" => { id => 'DOY' },
101             "5.17.2" => { id => 'TONYC' },
102             "5.17.3" => { id => 'SHAY' },
103             "5.17.4" => { id => 'FLORA' },
104             "5.17.5" => { id => 'FLORA' },
105             "5.17.7" => { id => 'DROLSKY' },
106             "5.17.8" => { id => 'ARC' },
107             "5.17.9" => { id => 'BINGOS' },
108             "5.18.0" => { id => 'RJBS' },
109             "5.18.1" => { id => 'RJBS' },
110             "5.19.1" => { id => 'DAGOLDEN' },
111             "5.19.3" => { id => 'SHAY' },
112             "5.19.4" => { id => 'SHAY' },
113             "5.19.5" => { id => 'SHAY' },
114             "5.19.6" => { id => 'BINGOS' },
115             "5.19.7" => { id => 'ABIGAIL' },
116             "5.18.2" => { id => 'RJBS' },
117             "5.19.9" => { id => 'TONYC' },
118             "5.19.10" => { id => 'ARC' },
119             "5.19.11" => { id => 'SHAY' },
120             "5.20.0" => { id => 'RJBS' },
121             "5.21.1" => { id => 'WOLFSAGE' },
122             "5.21.2" => { id => 'ABIGAIL' },
123             "5.21.3" => { id => 'PCM' },
124             "5.20.1-RC1" => { id => 'SHAY' },
125             "5.20.1-RC2" => { id => 'SHAY' },
126             "5.20.1" => { id => 'SHAY' },
127             "5.21.4" => { id => 'SHAY' },
128             "5.18.3" => { id => 'RJBS' },
129             "5.18.4" => { id => 'RJBS' },
130             "5.21.5" => { id => 'ABIGAIL' },
131             "5.21.6" => { id => 'BINGOS' },
132             "5.21.8" => { id => 'WOLFSAGE' },
133             "5.20.2-RC1" => { id => 'SHAY' },
134             "5.20.2" => { id => 'SHAY' },
135             "5.21.10" => { id => 'SHAY' },
136             "5.21.11" => { id => 'SHAY' },
137             "5.22.0" => { id => 'RJBS' },
138             "5.23.1" => { id => 'WOLFSAGE' },
139             "5.23.2" => { id => 'WOLFSAGE' },
140             "5.20.3-RC1" => { id => 'SHAY' },
141             "5.20.3-RC2" => { id => 'SHAY' },
142             "5.20.3" => { id => 'SHAY' },
143             "5.23.3" => { id => 'PCM' },
144             "5.23.4" => { id => 'SHAY' },
145             "5.22.1-RC1" => { id => 'SHAY' },
146             "5.22.1-RC2" => { id => 'SHAY' },
147             "5.23.5" => { id => 'ABIGAIL' },
148             "5.22.1-RC3" => { id => 'SHAY' },
149             "5.22.1-RC4" => { id => 'SHAY' },
150             "5.22.1" => { id => 'SHAY' },
151             "5.23.6" => { id => 'DAGOLDEN', noxz => 1 },
152             "5.23.7" => { id => 'STEVAN' },
153             "5.23.9" => { id => 'ABIGAIL' },
154             "5.22.2-RC1" => { id => 'SHAY' },
155             "5.22.2" => { id => 'SHAY' },
156             "5.24.0" => { id => 'RJBS' },
157             "5.25.2" => { id => 'WOLFSAGE' },
158             "5.22.3-RC1" => { id => 'SHAY' },
159             "5.24.1-RC1" => { id => 'SHAY' },
160             "5.25.3" => { id => 'SHAY' },
161             "5.22.3-RC2" => { id => 'SHAY' },
162             "5.24.1-RC2" => { id => 'SHAY' },
163             "5.22.3-RC3" => { id => 'SHAY' },
164             "5.24.1-RC3" => { id => 'SHAY' },
165             "5.25.4" => { id => 'BINGOS' },
166             "5.25.5" => { id => 'STEVAN' },
167             "5.22.3-RC4" => { id => 'SHAY' },
168             "5.24.1-RC4" => { id => 'SHAY' },
169             "5.25.6" => { id => 'ARC' },
170             "5.25.7" => { id => 'EXODIST' },
171             "5.22.3-RC5" => { id => 'SHAY' },
172             "5.24.1-RC5" => { id => 'SHAY', noxz => 1 },
173             "5.22.3" => { id => 'SHAY' },
174             "5.24.1" => { id => 'SHAY' },
175             "5.25.9" => { id => 'ABIGAIL' },
176             "5.25.10" => { id => 'RENEEB' },
177             "5.26.0" => { id => 'XSAWYERX' },
178             "5.27.1" => { id => 'EHERMAN' },
179             "5.22.4-RC1" => { id => 'SHAY' },
180             "5.24.2-RC1" => { id => 'SHAY' },
181             "5.22.4" => { id => 'SHAY' },
182             "5.24.2" => { id => 'SHAY' },
183             "5.27.2" => { id => 'ARC' },
184             "5.27.3" => { id => 'WOLFSAGE' },
185             "5.24.3-RC1" => { id => 'SHAY' },
186             "5.26.1-RC1" => { id => 'SHAY' },
187             "5.27.4" => { id => 'GENEHACK' },
188             "5.24.3" => { id => 'SHAY' },
189             "5.26.1" => { id => 'SHAY' },
190             "5.27.5" => { id => 'SHAY' },
191             "5.27.6" => { id => 'ETHER' },
192             "5.27.7" => { id => 'BINGOS' },
193             "5.27.8" => { id => 'ABIGAIL' },
194             "5.27.9" => { id => 'RENEEB' },
195             "5.27.10" => { id => 'TODDR' },
196             "5.24.4-RC1" => { id => 'SHAY' },
197             "5.26.2-RC1" => { id => 'SHAY' },
198             "5.24.4" => { id => 'SHAY' },
199             "5.26.2" => { id => 'SHAY' },
200             "5.27.11" => { id => 'XSAWYERX' },
201             "5.28.0-RC1" => { id => 'XSAWYERX' },
202             "5.28.0-RC2" => { id => 'XSAWYERX' },
203             "5.28.0-RC3" => { id => 'XSAWYERX' },
204             "5.28.0-RC4" => { id => 'XSAWYERX' },
205             "5.28.0" => { id => 'XSAWYERX' },
206             "5.29.0" => { id => 'XSAWYERX' },
207             "5.29.1" => { id => 'SHAY' },
208             "5.29.2" => { id => 'BINGOS' },
209             "5.29.3" => { id => 'GENEHACK' },
210             "5.29.4" => { id => 'ARC' },
211             "5.29.5" => { id => 'ETHER' },
212             "5.26.3" => { id => 'SHAY' },
213             "5.28.1" => { id => 'SHAY' },
214             "5.29.6" => { id => 'ABIGAIL' },
215             "5.29.7" => { id => 'ABIGAIL' },
216             "5.29.8" => { id => 'ATOOMIC' },
217             "5.29.9" => { id => 'ZAKAME' },
218             "5.28.2-RC1" => { id => 'SHAY' },
219             "5.28.2" => { id => 'SHAY' },
220             "5.29.10" => { id => 'XSAWYERX' },
221             "5.30.0-RC1" => { id => 'XSAWYERX' },
222             "5.30.0-RC2" => { id => 'XSAWYERX' },
223             "5.30.0" => { id => 'XSAWYERX' },
224             "5.31.0" => { id => 'XSAWYERX' },
225             "5.31.1" => { id => 'ETHER' },
226             "5.31.2" => { id => 'SHAY' },
227             "5.31.4" => { id => 'CORION' },
228             "5.31.5" => { id => 'SHAY' },
229             "5.30.1-RC1" => { id => 'SHAY' },
230             "5.30.1" => { id => 'SHAY' },
231             "5.31.6" => { id => 'BINGOS' },
232             "5.31.7" => { id => 'ATOOMIC' },
233             "5.31.8" => { id => 'WOLFSAGE' },
234             "5.31.9" => { id => 'RENEEB' },
235             "5.30.2-RC1" => { id => 'SHAY' },
236             "5.30.2" => { id => 'SHAY' },
237             "5.31.10" => { id => 'XSAWYERX' },
238             "5.31.11" => { id => 'XSAWYERX' },
239             "5.32.0-RC0" => { id => 'XSAWYERX' },
240             "5.28.3-RC1" => { id => 'XSAWYERX' },
241             "5.28.3" => { id => 'XSAWYERX' },
242             "5.30.3-RC1" => { id => 'XSAWYERX' },
243             "5.30.3" => { id => 'XSAWYERX' },
244             "5.32.0-RC1" => { id => 'XSAWYERX' },
245             "5.32.0" => { id => 'XSAWYERX' },
246             "5.33.0" => { id => 'XSAWYERX' },
247             "5.33.1" => { id => 'ETHER' },
248             "5.33.2" => { id => 'XSAWYERX' },
249             "5.33.3" => { id => 'SHAY' },
250             "5.33.5" => { id => 'CORION' },
251             "5.32.1-RC1" => { id => 'SHAY' },
252             "5.33.6" => { id => 'HYDAHY' },
253             "5.32.1" => { id => 'SHAY' },
254             "5.33.7" => { id => 'RENEEB' },
255             "5.33.8" => { id => 'ATOOMIC' },
256             "5.33.9" => { id => 'TODDR' },
257             "5.34.0-RC1" => { id => 'XSAWYERX' },
258             "5.34.0-RC2" => { id => 'XSAWYERX' },
259             "5.34.0" => { id => 'XSAWYERX' },
260             "5.35.0" => { id => 'RJBS' },
261             "5.35.1" => { id => 'CORION' },
262             "5.35.3" => { id => 'ETHER' },
263             "5.35.4" => { id => 'WOLFSAGE' },
264             "5.35.5" => { id => 'LEONT' },
265             "5.35.6" => { id => 'HYDAHY' },
266             "5.35.8" => { id => 'ATOOMIC' },
267             "5.35.9" => { id => 'RENEEB' },
268             "5.34.1-RC1" => { id => 'SHAY' },
269             "5.34.1-RC2" => { id => 'SHAY' },
270             "5.34.1" => { id => 'SHAY' },
271             "5.35.10" => { id => 'XSAWYERX' },
272             "5.35.11" => { id => 'SHAY' },
273             "5.36.0-RC2" => { id => 'RJBS' },
274             "5.36.0-RC3" => { id => 'RJBS' },
275             "5.36.0" => { id => 'RJBS' },
276             "5.37.0" => { id => 'RJBS' },
277             "5.37.1" => { id => 'WOLFSAGE' },
278             "5.37.2" => { id => 'ATOOMIC' },
279             "5.37.4" => { id => 'ETHER' },
280             "5.37.5" => { id => 'TODDR' },
281             "5.37.6" => { id => 'CORION' },
282             "5.37.7" => { id => 'HYDAHY' },
283             "5.37.8" => { id => 'RENEEB' },
284             "5.37.9" => { id => 'ETHER' },
285             "5.37.10" => { id => 'YVES' },
286             "5.36.1-RC1" => { id => 'SHAY' },
287             "5.36.1-RC2" => { id => 'SHAY' },
288             "5.36.1-RC3" => { id => 'SHAY' },
289             "5.37.11" => { id => 'SHAY' },
290             "5.36.1" => { id => 'SHAY' },
291             "5.38.0-RC1" => { id => 'RJBS' },
292             "5.38.0-RC2" => { id => 'RJBS' },
293             "5.38.0" => { id => 'RJBS' },
294             "5.39.1" => { id => 'SHAY' },
295             };
296              
297             sub perl_tarballs {
298 99     99 1 53521 my $vers = shift;
299 99 100       261 return unless defined $vers;
300 98 100       150 $vers = shift if eval { $vers->isa(__PACKAGE__) };
  98         698  
301 98 100       321 return unless exists $data->{ $vers };
302 97 100       205 if ( exists $cache->{ $vers } ) {
303 2         4 return { %{ $cache->{ $vers } } };
  2         10  
304             }
305 95         212 my $pumpkin = $data->{ $vers }->{id};
306 95         347 my $path = join '/', substr( $pumpkin, 0, 1 ), substr( $pumpkin, 0, 2 ), $pumpkin;
307 95 100       359 my $sep = ( $vers =~ m!^5\.0! ? '' : '-' );
308 95         194 my $perl = join $sep, 'perl', $vers;
309 95 100 66     681 my $onlygz = 1 if $vers =~ m!(?-xism:5.(?:00(?:4(?:_0[12345])?|5(?:_0[1234])?|3_07)|1(?:0.0(?:-RC[12])?|6.0-RC0)|6.(?:[02]|1(?:-TRIAL[123])?)|9.[12345]|7.[0123]|8.[01]))! || $data->{ $vers }->{onlygz};
310 95 50       255 my $onlybz2 = 1 if $data->{ $vers }->{onlybz2};
311 95 50       185 my $noxz = 1 if $data->{ $vers }->{noxz};
312 95         128 my $lvers;
313             {
314 95         154 my $tvers = $vers;
  95         146  
315 95         345 $tvers =~ s!\-?(TRIAL|RC)\d*!!g;
316 95         167 $tvers =~ s!_!.!g;
317 95         291 my @parts = split m!\.!, $tvers;
318 95 100       253 push @parts, 0 if scalar @parts < 3;
319 95         545 $lvers = sprintf("%d.%03d%03d",@parts);
320             }
321 95         188 my $foo = { };
322 95 50       382 $foo->{'tar.gz'} = "$path/$perl.tar.gz" unless $onlybz2;
323 95 100 66     457 $foo->{'tar.bz2'} = "$path/$perl.tar.bz2" unless $onlygz || $lvers > 5.027005;
324 95 100 66     282 $foo->{'tar.xz'} = "$path/$perl.tar.xz" if $lvers > 5.021005 && !$noxz;
325 95 100 66     209 delete $foo->{'tar.bz2'} if $pumpkin eq 'SHAY' && $lvers < 5.028000;
326 95         205 $cache->{ $vers } = $foo;
327 95         403 return { %$foo };
328             }
329              
330             sub perl_versions {
331 1     1 1 350 return sort _by_version keys %$data;
332             }
333              
334              
335             sub _by_version {
336             my %v = map {
337 1888     1888   2804 my @v = split(qr/[-._]0*/, $_);
  3776         18056  
338 3776   100     9740 $v[2] ||= 0;
339 3776   100     10938 $v[3] ||= 'Z';
340 3776         15634 ($_ => sprintf '%d.%03d%03d-%s', @v)
341             } $a, $b;
342 1888         4715 $v{$a} cmp $v{$b};
343             }
344              
345             sub perl_pumpkins {
346 1     1 1 1008 my %pumps = map { ( $data->{$_}->{id} => 1 ) } keys %$data;
  276         607  
347 1         55 return sort keys %pumps;
348             }
349              
350             q|Acme::Why::Did::I::Not::Read::The::Fecking::Memo|;
351              
352             __END__