This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge branch 'blead' of ssh://perl5.git.perl.org/perl into blead
[perl5.git] / dist / Module-CoreList / lib / Module / CoreList / Utils.pm
CommitLineData
e4f0ee67
CBW
1package Module::CoreList::Utils;
2
3use strict;
4use warnings;
5use vars qw[$VERSION %utilities];
6use Module::CoreList;
e4f0ee67 7
2b776413 8$VERSION = '5.20170120';
e4f0ee67
CBW
9
10sub utilities {
11 my $perl = shift;
12 $perl = shift if eval { $perl->isa(__PACKAGE__) };
13 return unless $perl or exists $utilities{$perl};
14 return sort keys %{ $utilities{$perl} };
15}
16
02b4438c
KW
17sub _released_order { # Sort helper, to make '?' sort after everything else
18 (substr($Module::CoreList::released{$a}, 0, 1) eq "?")
19 ? ((substr($Module::CoreList::released{$b}, 0, 1) eq "?")
20 ? 0
21 : 1)
22 : ((substr($Module::CoreList::released{$b}, 0, 1) eq "?")
23 ? -1
24 : $Module::CoreList::released{$a} cmp $Module::CoreList::released{$b} )
25}
26
e4f0ee67
CBW
27sub first_release_raw {
28 my $util = shift;
29 $util = shift if eval { $util->isa(__PACKAGE__) };
30 #and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
31 my $version = shift;
32
33 my @perls = $version
34 ? grep { exists $utilities{$_}{ $util } &&
35 $utilities{$_}{ $util } ge $version } keys %utilities
36 : grep { exists $utilities{$_}{ $util } } keys %utilities;
37
38 return grep { exists $Module::CoreList::released{$_} } @perls;
39}
40
41sub first_release_by_date {
42 my @perls = &first_release_raw;
43 return unless @perls;
02b4438c 44 return (sort _released_order @perls)[0];
e4f0ee67
CBW
45}
46
47sub first_release {
48 my @perls = &first_release_raw;
49 return unless @perls;
50 return (sort { $a cmp $b } @perls)[0];
51}
52
53sub removed_from {
54 my @perls = &removed_raw;
55 return shift @perls;
56}
57
58sub removed_from_by_date {
02b4438c 59 my @perls = sort _released_order &removed_raw;
e4f0ee67
CBW
60 return shift @perls;
61}
62
63sub removed_raw {
64 my $util = shift;
65 $util = shift if eval { $util->isa(__PACKAGE__) };
66 return unless my @perls = sort { $a cmp $b } first_release_raw($util);
67 @perls = grep { exists $Module::CoreList::released{$_} } @perls;
68 my $last = pop @perls;
69 my @removed = grep { $_ > $last } sort { $a cmp $b } keys %utilities;
70 return @removed;
71}
72
73my %delta = (
74 5 => {
75 changed => {
76 'a2p' => '1',
77 'c2ph' => '1',
78 'cppstdin' => '1',
79 'find2perl' => '1',
80 'pstruct' => '1',
81 's2p' => '1',
82 },
83 removed => {
84 }
85 },
86
87 5.001 => {
88 delta_from => 5,
89 changed => {
90 'h2xs' => '1',
91 },
92 removed => {
93 }
94 },
95
96 5.002 => {
97 delta_from => 5.001,
98 changed => {
99 'h2ph' => '1',
100 'perlbug' => '1',
101 'perldoc' => '1',
102 'pod2html' => '1',
103 'pod2latex' => '1',
104 'pod2man' => '1',
105 'pod2text' => '1',
106 },
107 removed => {
108 }
109 },
110
111 5.00307 => {
112 delta_from => 5.002,
113 changed => {
114 'pl2pm' => '1',
115 },
116 removed => {
117 'cppstdin' => 1,
118 'pstruct' => 1,
119 }
120 },
121
122 5.004 => {
123 delta_from => 5.00307,
124 changed => {
125 'splain' => '1',
126 },
127 removed => {
128 }
129 },
130
131 5.005 => {
132 delta_from => 5.00405,
133 changed => {
134 'perlcc' => '1',
135 },
136 removed => {
137 }
138 },
139
140 5.00503 => {
141 delta_from => 5.005,
142 changed => {
143 },
144 removed => {
145 }
146 },
147
148 5.00405 => {
149 delta_from => 5.004,
150 changed => {
151 },
152 removed => {
153 }
154 },
155
156 5.006 => {
157 delta_from => 5.00504,
158 changed => {
159 'dprofpp' => '1',
160 'pod2usage' => '1',
161 'podchecker' => '1',
162 'podselect' => '1',
163 'pstruct' => '1',
164 },
165 removed => {
166 }
167 },
168
169 5.006001 => {
170 delta_from => 5.006,
171 changed => {
172 },
173 removed => {
174 }
175 },
176
177 5.007003 => {
178 delta_from => 5.006002,
179 changed => {
180 'libnetcfg' => '1',
181 'perlivp' => '1',
182 'psed' => '1',
183 'xsubpp' => '1',
184 },
185 removed => {
186 }
187 },
188
189 5.008 => {
190 delta_from => 5.007003,
191 changed => {
192 'enc2xs' => '1',
193 'piconv' => '1',
194 },
195 removed => {
196 }
197 },
198
199 5.008001 => {
200 delta_from => 5.008,
201 changed => {
202 'cpan' => '1',
203 },
204 removed => {
205 }
206 },
207
208 5.009 => {
209 delta_from => 5.008009,
210 changed => {
211 },
212 removed => {
213 'corelist' => 1,
214 'instmodsh' => 1,
215 'prove' => 1,
216 }
217 },
218
219 5.008002 => {
220 delta_from => 5.008001,
221 changed => {
222 },
223 removed => {
224 }
225 },
226
227 5.006002 => {
228 delta_from => 5.006001,
229 changed => {
230 },
231 removed => {
232 }
233 },
234
235 5.008003 => {
236 delta_from => 5.008002,
237 changed => {
238 'instmodsh' => '1',
239 'prove' => '1',
240 },
241 removed => {
242 }
243 },
244
245 5.00504 => {
246 delta_from => 5.00503,
247 changed => {
248 },
249 removed => {
250 }
251 },
252
253 5.009001 => {
254 delta_from => 5.009,
255 changed => {
256 'instmodsh' => '1',
257 'prove' => '1',
258 },
259 removed => {
260 }
261 },
262
263 5.008004 => {
264 delta_from => 5.008003,
265 changed => {
266 },
267 removed => {
268 }
269 },
270
271 5.008005 => {
272 delta_from => 5.008004,
273 changed => {
274 },
275 removed => {
276 }
277 },
278
279 5.008006 => {
280 delta_from => 5.008005,
281 changed => {
282 },
283 removed => {
284 }
285 },
286
287 5.009002 => {
288 delta_from => 5.009001,
289 changed => {
290 'corelist' => '1',
291 },
292 removed => {
293 }
294 },
295
296 5.008007 => {
297 delta_from => 5.008006,
298 changed => {
299 },
300 removed => {
301 }
302 },
303
304 5.009003 => {
305 delta_from => 5.009002,
306 changed => {
307 'ptar' => '1',
308 'ptardiff' => '1',
309 'shasum' => '1',
310 },
311 removed => {
312 }
313 },
314
315 5.008008 => {
316 delta_from => 5.008007,
317 changed => {
318 },
319 removed => {
320 }
321 },
322
323 5.009004 => {
324 delta_from => 5.009003,
325 changed => {
326 'config_data' => '1',
327 },
328 removed => {
329 }
330 },
331
332 5.009005 => {
333 delta_from => 5.009004,
334 changed => {
335 'cpan2dist' => '1',
336 'cpanp' => '1',
337 'cpanp-run-perl' => '1',
338 },
339 removed => {
340 'perlcc' => 1,
341 }
342 },
343
344 5.010000 => {
345 delta_from => 5.009005,
346 changed => {
347 },
348 removed => {
349 }
350 },
351
352 5.008009 => {
353 delta_from => 5.008008,
354 changed => {
355 'corelist' => '1',
356 },
357 removed => {
358 }
359 },
360
361 5.010001 => {
362 delta_from => 5.010000,
363 changed => {
364 },
365 removed => {
366 }
367 },
368
369 5.011 => {
370 delta_from => 5.010001,
371 changed => {
372 },
373 removed => {
374 }
375 },
376
377 5.011001 => {
378 delta_from => 5.011,
379 changed => {
380 },
381 removed => {
382 }
383 },
384
385 5.011002 => {
386 delta_from => 5.011001,
387 changed => {
388 'perlthanks' => '1',
389 },
390 removed => {
391 }
392 },
393
394 5.011003 => {
395 delta_from => 5.011002,
396 changed => {
397 },
398 removed => {
399 }
400 },
401
402 5.011004 => {
403 delta_from => 5.011003,
404 changed => {
405 },
406 removed => {
407 }
408 },
409
410 5.011005 => {
411 delta_from => 5.011004,
412 changed => {
413 },
414 removed => {
415 }
416 },
417
418 5.012 => {
419 delta_from => 5.011005,
420 changed => {
421 },
422 removed => {
423 }
424 },
425
426 5.013 => {
427 delta_from => 5.012005,
428 changed => {
429 },
430 removed => {
431 }
432 },
433
434 5.012001 => {
435 delta_from => 5.012,
436 changed => {
437 },
438 removed => {
439 }
440 },
441
442 5.013001 => {
443 delta_from => 5.013,
444 changed => {
445 },
446 removed => {
447 }
448 },
449
450 5.013002 => {
451 delta_from => 5.013001,
452 changed => {
453 },
454 removed => {
455 }
456 },
457
458 5.013003 => {
459 delta_from => 5.013002,
460 changed => {
461 },
462 removed => {
463 }
464 },
465
466 5.013004 => {
467 delta_from => 5.013003,
468 changed => {
469 },
470 removed => {
471 }
472 },
473
474 5.012002 => {
475 delta_from => 5.012001,
476 changed => {
477 },
478 removed => {
479 }
480 },
481
482 5.013005 => {
483 delta_from => 5.013004,
484 changed => {
485 },
486 removed => {
487 }
488 },
489
490 5.013006 => {
491 delta_from => 5.013005,
492 changed => {
493 },
494 removed => {
495 }
496 },
497
498 5.013007 => {
499 delta_from => 5.013006,
500 changed => {
501 'ptargrep' => '1',
502 },
503 removed => {
504 }
505 },
506
507 5.013008 => {
508 delta_from => 5.013007,
509 changed => {
510 },
511 removed => {
512 }
513 },
514
515 5.013009 => {
516 delta_from => 5.013008,
517 changed => {
518 'json_pp' => '1',
519 },
520 removed => {
521 }
522 },
523
524 5.012003 => {
525 delta_from => 5.012002,
526 changed => {
527 },
528 removed => {
529 }
530 },
531
532 5.013010 => {
533 delta_from => 5.013009,
534 changed => {
535 },
536 removed => {
537 }
538 },
539
540 5.013011 => {
541 delta_from => 5.013010,
542 changed => {
543 },
544 removed => {
545 }
546 },
547
548 5.014 => {
549 delta_from => 5.013011,
550 changed => {
551 },
552 removed => {
553 }
554 },
555
556 5.014001 => {
557 delta_from => 5.014,
558 changed => {
559 },
560 removed => {
561 }
562 },
563
564 5.015 => {
565 delta_from => 5.014004,
566 changed => {
567 },
568 removed => {
569 'dprofpp' => 1,
570 }
571 },
572
573 5.012004 => {
574 delta_from => 5.012003,
575 changed => {
576 },
577 removed => {
578 }
579 },
580
581 5.015001 => {
582 delta_from => 5.015,
583 changed => {
584 },
585 removed => {
586 }
587 },
588
589 5.015002 => {
590 delta_from => 5.015001,
591 changed => {
592 },
593 removed => {
594 }
595 },
596
597 5.015003 => {
598 delta_from => 5.015002,
599 changed => {
600 },
601 removed => {
602 }
603 },
604
605 5.014002 => {
606 delta_from => 5.014001,
607 changed => {
608 },
609 removed => {
610 }
611 },
612
613 5.015004 => {
614 delta_from => 5.015003,
615 changed => {
616 },
617 removed => {
618 }
619 },
620
621 5.015005 => {
622 delta_from => 5.015004,
623 changed => {
624 },
625 removed => {
626 }
627 },
628
629 5.015006 => {
630 delta_from => 5.015005,
631 changed => {
632 'zipdetails' => '1',
633 },
634 removed => {
635 }
636 },
637
638 5.015007 => {
639 delta_from => 5.015006,
640 changed => {
641 },
642 removed => {
643 }
644 },
645
646 5.015008 => {
647 delta_from => 5.015007,
648 changed => {
649 },
650 removed => {
651 }
652 },
653
654 5.015009 => {
655 delta_from => 5.015008,
656 changed => {
657 },
658 removed => {
659 }
660 },
661
662 5.016 => {
663 delta_from => 5.015009,
664 changed => {
665 },
666 removed => {
667 }
668 },
669
670 5.017 => {
671 delta_from => 5.016003,
672 changed => {
673 },
674 removed => {
675 }
676 },
677
678 5.017001 => {
679 delta_from => 5.017,
680 changed => {
681 },
682 removed => {
683 }
684 },
685
686 5.017002 => {
687 delta_from => 5.017001,
688 changed => {
689 },
690 removed => {
691 }
692 },
693
694 5.016001 => {
695 delta_from => 5.016,
696 changed => {
697 },
698 removed => {
699 }
700 },
701
702 5.017003 => {
703 delta_from => 5.017002,
704 changed => {
705 },
706 removed => {
707 }
708 },
709
710 5.017004 => {
711 delta_from => 5.017003,
712 changed => {
713 },
714 removed => {
715 }
716 },
717
718 5.014003 => {
719 delta_from => 5.014002,
720 changed => {
721 },
722 removed => {
723 }
724 },
725
726 5.017005 => {
727 delta_from => 5.017004,
728 changed => {
729 },
730 removed => {
731 }
732 },
733
734 5.016002 => {
735 delta_from => 5.016001,
736 changed => {
737 },
738 removed => {
739 }
740 },
741
742 5.012005 => {
743 delta_from => 5.012004,
744 changed => {
745 },
746 removed => {
747 }
748 },
749
750 5.017006 => {
751 delta_from => 5.017005,
752 changed => {
753 },
754 removed => {
755 }
756 },
757
758 5.017007 => {
759 delta_from => 5.017006,
760 changed => {
761 },
762 removed => {
763 }
764 },
765
766 5.017008 => {
767 delta_from => 5.017007,
768 changed => {
769 },
770 removed => {
771 }
772 },
773
774 5.017009 => {
775 delta_from => 5.017008,
776 changed => {
777 },
778 removed => {
779 }
780 },
781
782 5.014004 => {
783 delta_from => 5.014003,
784 changed => {
785 },
786 removed => {
787 }
788 },
789
790 5.016003 => {
791 delta_from => 5.016002,
792 changed => {
793 },
794 removed => {
795 }
796 },
797
798 5.017010 => {
799 delta_from => 5.017009,
800 changed => {
801 },
802 removed => {
803 }
804 },
805
806 5.017011 => {
807 delta_from => 5.017010,
808 changed => {
809 },
810 removed => {
811 }
812 },
5730025f
CBW
813 5.018000 => {
814 delta_from => 5.017011,
815 changed => {
816 },
817 removed => {
818 }
819 },
ba4dd7ef
RS
820 5.018001 => {
821 delta_from => 5.018000,
822 changed => {
823 },
6c2a7b42
CBW
824 removed => {
825 }
826 },
827 5.018002 => {
828 delta_from => 5.018001,
829 changed => {
830 },
ba4dd7ef
RS
831 removed => {
832 }
833 },
b616d4df
RS
834 5.018003 => {
835 delta_from => 5.018000,
836 changed => {
837 },
838 removed => {
839 }
840 },
841 5.018004 => {
842 delta_from => 5.018000,
843 changed => {
844 },
845 removed => {
846 }
847 },
5730025f
CBW
848 5.019000 => {
849 delta_from => 5.018000,
850 changed => {
851 },
852 removed => {
853 'cpan2dist' => '1',
854 'cpanp' => '1',
855 'cpanp-run-perl' => '1',
856 'pod2latex' => '1',
857 }
858 },
8c94cb79
CBW
859 5.019001 => {
860 delta_from => 5.019000,
861 changed => {
862 },
863 removed => {
864 }
865 },
d04adc20
DG
866 5.019002 => {
867 delta_from => 5.019001,
868 changed => {
869 },
870 removed => {
871 }
872 },
84ac8f84
CBW
873 5.019003 => {
874 delta_from => 5.019002,
875 changed => {
876 },
877 removed => {
878 }
879 },
37287258
SH
880 5.019004 => {
881 delta_from => 5.019003,
882 changed => {
883 },
884 removed => {
885 }
886 },
fa5fbb39
SH
887 5.019005 => {
888 delta_from => 5.019004,
889 changed => {
890 },
891 removed => {
892 }
893 },
494bd897
SH
894 5.019006 => {
895 delta_from => 5.019005,
896 changed => {
897 },
898 removed => {
899 }
900 },
b3f76264
CBW
901 5.019007 => {
902 delta_from => 5.019006,
903 changed => {
904 },
905 removed => {
906 }
907 },
365f8c3e
CBW
908 5.019008 => {
909 delta_from => 5.019007,
910 changed => {
911 },
912 removed => {
913 }
914 },
a27b5f52
CBW
915 5.019009 => {
916 delta_from => 5.019008,
917 changed => {
918 },
919 removed => {
920 }
921 },
baca4554
TC
922 5.019010 => {
923 delta_from => 5.019009,
924 changed => {
925 },
926 removed => {
927 }
928 },
b776cec1
AC
929 5.019011 => {
930 delta_from => 5.019010,
931 changed => {
932 },
933 removed => {
934 }
935 },
1b6c17c2 936 5.020000 => {
48cbd9dd
SH
937 delta_from => 5.019011,
938 changed => {
939 },
940 removed => {
941 }
942 },
75325e51 943 5.021000 => {
4f2cd4f7 944 delta_from => 5.020000,
75325e51
RS
945 changed => {
946 },
947 removed => {
948 }
949 },
5a534470
RS
950 5.021001 => {
951 delta_from => 5.021000,
952 changed => {
953 },
954 removed => {
04c0d500 955 'a2p' => 1,
5a534470 956 'config_data' => 1,
04c0d500
MH
957 'find2perl' => 1,
958 'psed' => 1,
959 's2p' => 1,
5a534470
RS
960 }
961 },
2901561d
MH
962 5.021002 => {
963 delta_from => 5.021001,
964 changed => {
965 },
966 removed => {
967 }
968 },
633c51bc
A
969 5.021003 => {
970 delta_from => 5.021002,
971 changed => {
972 },
973 removed => {
974 }
975 },
14cc2657
SH
976 5.020001 => {
977 delta_from => 5.02,
5c851aa1
PM
978 changed => {
979 },
980 removed => {
981 }
982 },
14cc2657
SH
983 5.021004 => {
984 delta_from => 5.021003,
1c6aa017
SH
985 changed => {
986 },
987 removed => {
988 }
989 },
84d03adf
SH
990 5.021005 => {
991 delta_from => 5.021004,
992 changed => {
993 },
994 removed => {
995 }
996 },
e22432a4
A
997 5.021006 => {
998 delta_from => 5.021005,
999 changed => {
1000 },
1001 removed => {
1002 }
1003 },
3f572b05
CBW
1004 5.021007 => {
1005 delta_from => 5.021006,
1006 changed => {
1007 },
1008 removed => {
1009 }
1010 },
e31034da
MM
1011 5.021008 => {
1012 delta_from => 5.021007,
1013 changed => {
1014 },
1015 removed => {
1016 }
1017 },
8ad047ea
SH
1018 5.020002 => {
1019 delta_from => 5.020001,
1020 changed => {
1021 },
1022 removed => {
1023 }
1024 },
2e3866c3
MH
1025 5.021009 => {
1026 delta_from => 5.021008,
1027 changed => {
c02a3722 1028 'encguess' => '1',
2e3866c3
MH
1029 },
1030 removed => {
1031 }
1032 },
ff4e8df2
S
1033 5.021010 => {
1034 delta_from => 5.021009,
1035 changed => {
1036 },
1037 removed => {
1038 }
1039 },
53902397
SH
1040 5.021011 => {
1041 delta_from => 5.02101,
1042 changed => {
1043 },
1044 removed => {
1045 }
1046 },
bff00388 1047 5.022000 => {
6bb5549b
SH
1048 delta_from => 5.021011,
1049 changed => {
1050 },
1051 removed => {
1052 }
1053 },
19aba073
RS
1054 5.023000 => {
1055 delta_from => 5.022000,
1056 changed => {
1057 },
1058 removed => {
1059 }
1060 },
b9e156a2
RS
1061 5.023001 => {
1062 delta_from => 5.023,
1063 changed => {
1064 },
1065 removed => {
1066 }
1067 },
923c264e
MH
1068 5.023002 => {
1069 delta_from => 5.023001,
1070 changed => {
1071 },
1072 removed => {
1073 }
1074 },
2490a830
SH
1075 5.020003 => {
1076 delta_from => 5.020002,
1077 changed => {
1078 },
1079 removed => {
1080 }
1081 },
c0bc7731
MH
1082 5.023003 => {
1083 delta_from => 5.023002,
1084 changed => {
1085 },
1086 removed => {
1087 }
1088 },
2d9b5f10
PM
1089 5.023004 => {
1090 delta_from => 5.023003,
1091 changed => {
1092 },
1093 removed => {
1094 }
1095 },
7792a6f5
SH
1096 5.023005 => {
1097 delta_from => 5.023004,
1098 changed => {
1099 },
1100 removed => {
1101 }
1102 },
83cfc1da
SH
1103 5.022001 => {
1104 delta_from => 5.022,
1105 changed => {
1106 },
1107 removed => {
1108 }
1109 },
7c294235
A
1110 5.023006 => {
1111 delta_from => 5.023005,
1112 changed => {
1113 },
1114 removed => {
1115 }
1116 },
5d4cc497
DG
1117 5.023007 => {
1118 delta_from => 5.023006,
1119 changed => {
1120 },
1121 removed => {
1122 }
1123 },
519be8b0
TC
1124 5.023008 => {
1125 delta_from => 5.023007,
1126 changed => {
1127 },
1128 removed => {
1129 }
1130 },
0515d31c
S
1131 5.023009 => {
1132 delta_from => 5.023008,
1133 changed => {
1134 },
1135 removed => {
1136 }
1137 },
e42cacf8
SH
1138 5.022002 => {
1139 delta_from => 5.022001,
1140 changed => {
1141 },
1142 removed => {
1143 }
1144 },
de1edec7 1145 5.024000 => {
d1fa969e
A
1146 delta_from => 5.023009,
1147 changed => {
1148 },
1149 removed => {
1150 }
1151 },
c800d8b3
RS
1152 5.025000 => {
1153 delta_from => 5.024000,
1154 changed => {
1155 },
1156 removed => {
1157 }
1158 },
4170737e 1159 5.025001 => {
f7a1e8ff 1160 delta_from => 5.025000,
4170737e
RS
1161 changed => {
1162 },
1163 removed => {
1164 }
1165 },
a55ca2cb
FC
1166 5.025002 => {
1167 delta_from => 5.025001,
1168 changed => {
1169 },
1170 removed => {
1171 }
1172 },
c338e234
MH
1173 5.025003 => {
1174 delta_from => 5.025002,
1175 changed => {
1176 },
1177 removed => {
1178 }
1179 },
dec2b171
SH
1180 5.025004 => {
1181 delta_from => 5.025003,
1182 changed => {
1183 },
1184 removed => {
1185 }
1186 },
9b3afcbd
CBW
1187 5.025005 => {
1188 delta_from => 5.025004,
1189 changed => {
1190 },
1191 removed => {
1192 }
1193 },
bc46539a
SL
1194 5.025006 => {
1195 delta_from => 5.025005,
1196 changed => {
1197 },
1198 removed => {
1199 }
1200 },
935d7564
AC
1201 5.025007 => {
1202 delta_from => 5.025006,
1203 changed => {
1204 },
1205 removed => {
1206 }
1207 },
d5584eb3
CG
1208 5.025008 => {
1209 delta_from => 5.025007,
1210 changed => {
1211 },
1212 removed => {
1213 }
1214 },
2b776413
JK
1215 5.025009 => {
1216 delta_from => 5.025008,
1217 changed => {
1218 },
1219 removed => {
1220 }
1221 },
e4f0ee67
CBW
1222);
1223
8bbcf42b 1224%utilities = Module::CoreList::_undelta(\%delta);
e4f0ee67
CBW
1225
1226# Create aliases with trailing zeros for $] use
1227
1228$utilities{'5.000'} = $utilities{5};
1229
1230_create_aliases(\%utilities);
1231
1232sub _create_aliases {
1233 my ($hash) = @_;
1234
1235 for my $version (keys %$hash) {
1236 next unless $version >= 5.010;
1237
1238 my $padded = sprintf "%0.6f", $version;
1239
1240 # If the version in string form isn't the same as the numeric version,
1241 # alias it.
1242 if ($padded ne $version && $version == $padded) {
1243 $hash->{$padded} = $hash->{$version};
1244 }
1245 }
1246}
1247
1248'foo';
7a0b45a1
CBW
1249
1250=pod
1251
1252=head1 NAME
1253
1254Module::CoreList::Utils - what utilities shipped with versions of perl
1255
1256=head1 SYNOPSIS
1257
1258 use Module::CoreList::Utils;
1259
1260 print $Module::CoreList::Utils::utilities{5.009003}{ptar}; # prints 1
1261
e46aa1dd
KW
1262 print Module::CoreList::Utils->first_release('corelist');
1263 # prints 5.008009
1264
1265 print Module::CoreList::Utils->first_release_by_date('corelist');
1266 # prints 5.009002
7a0b45a1
CBW
1267
1268=head1 DESCRIPTION
1269
1270Module::CoreList::Utils provides information on which core and dual-life utilities shipped
1271with each version of L<perl>.
1272
1273It provides a number of mechanisms for querying this information.
1274
1275There is a functional programming API available for programmers to query
1276information.
1277
1278Programmers may also query the contained hash structure to find relevant
1279information.
1280
1281=head1 FUNCTIONS API
1282
1283These are the functions that are available, they may either be called as functions or class methods:
1284
1285 Module::CoreList::Utils::first_release('corelist'); # as a function
1286
1287 Module::CoreList::Utils->first_release('corelist'); # class method
1288
1289=over
1290
1291=item C<utilities>
1292
1293Requires a perl version as an argument, returns a list of utilities that shipped with
1294that version of perl, or undef/empty list if that perl doesn't exist.
1295
1296=item C<first_release( UTILITY )>
1297
1298Requires a UTILITY name as an argument, returns the perl version when that utility first
1299appeared in core as ordered by perl version number or undef ( in scalar context )
1300or an empty list ( in list context ) if that utility is not in core.
1301
1302=item C<first_release_by_date( UTILITY )>
1303
1304Requires a UTILITY name as an argument, returns the perl version when that utility first
1305appeared in core as ordered by release date or undef ( in scalar context )
1306or an empty list ( in list context ) if that utility is not in core.
1307
1308=item C<removed_from( UTILITY )>
1309
1310Takes a UTILITY name as an argument, returns the first perl version where that utility
1311was removed from core. Returns undef if the given utility was never in core or remains
1312in core.
1313
1314=item C<removed_from_by_date( UTILITY )>
1315
1316Takes a UTILITY name as an argument, returns the first perl version by release date where that
1317utility was removed from core. Returns undef if the given utility was never in core or remains
1318in core.
1319
1320=back
1321
1322=head1 DATA STRUCTURES
1323
1324These are the hash data structures that are available:
1325
1326=over
1327
1328=item C<%Module::CoreList::Utils::utilities>
1329
1330A hash of hashes that is keyed on perl version as indicated
1331in $]. The second level hash is utility / defined pairs.
1332
1333=back
1334
1335=head1 AUTHOR
1336
1337Chris C<BinGOs> Williams <chris@bingosnet.co.uk>
1338
1339Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.
1340
1341This module is the result of archaeology undertaken during QA Hackathon
1342in Lancaster, April 2013.
1343
1344=head1 LICENSE
1345
1346Copyright (C) 2013 Chris Williams. All Rights Reserved.
1347
1348This module is free software; you can redistribute it and/or modify it
1349under the same terms as Perl itself.
1350
1351=head1 SEE ALSO
1352
1353L<corelist>, L<Module::CoreList>, L<perl>, L<http://perlpunks.de/corelist>
1354
1355=cut