This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Really submit previous change
[perl5.git] / Porting / corelist.pl
CommitLineData
4a656c5e
RGS
1#!perl
2# Generates info for Module::CoreList from this perl tree
3# run this from the root of a clean perl tree
4
4a656c5e
RGS
5use strict;
6use warnings;
7use File::Find;
8use ExtUtils::MM_Unix;
9
10my @lines;
11find(sub {
12 /(\.pm|_pm\.PL)$/ or return;
d51d469b 13 /PPPort\.pm$/ and return;
4a656c5e 14 my $module = $File::Find::name;
d51d469b
RGS
15 $module =~ /\b(demo|t|private)\b/ and return; # demo or test modules
16 my $version = MM->parse_version($_);
17 defined $version or $version = 'undef';
4a656c5e
RGS
18 $version =~ /\d/ and $version = "'$version'";
19 # some heuristics to figure out the module name from the file name
20 $module =~ s{^(lib|ext)/}{}
21 and $1 eq 'ext'
22 and ( $module =~ s{^(.*)/lib/\1\b}{$1},
23 $module =~ s{(\w+)/\1\b}{$1},
d51d469b
RGS
24 $module =~ s{^Compress/IO/Base/lib/}{},
25 $module =~ s{^Devel/PPPort}{Devel},
4a656c5e
RGS
26 $module =~ s{^Encode/encoding}{encoding},
27 $module =~ s{^MIME/Base64/QuotedPrint}{MIME/QuotedPrint},
28 $module =~ s{^List/Util/lib/Scalar}{Scalar},
29 $module =~ s{^(?:DynaLoader|Errno)/}{},
30 );
31 $module =~ s{/}{::}g;
32 $module =~ s/(\.pm|_pm\.PL)$//;
33 push @lines, sprintf "\t%-24s=> $version,\n", "'$module'";
34}, 'lib', 'ext');
35print " $] => {\n";
36print sort @lines;
37print " },\n";