From: Rafael Garcia-Suarez Date: Thu, 31 Mar 2005 12:42:38 +0000 (+0000) Subject: Add a tool to generate data for Module::CoreList X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a656c5eef87fdcd0f47ec405e089d37434e6c6b;p=p5sagit%2Fp5-mst-13.2.git Add a tool to generate data for Module::CoreList p4raw-id: //depot/perl@24115 --- diff --git a/MANIFEST b/MANIFEST index f142b85..6adb4be 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2361,6 +2361,7 @@ Porting/config_H Sample config.h Porting/config.sh Sample config.sh Porting/Contract Social contract for contributed modules in Perl core Porting/corecpan.pl Reports outdated dual-lived modules +Porting/corelist.pl Generates data for Module::CoreList Porting/curliff.pl Curliff or liff your curliffable files. Porting/findrfuncs Find reentrant variants of functions used in an executable Porting/findvars Find occurrences of words diff --git a/Porting/corelist.pl b/Porting/corelist.pl new file mode 100644 index 0000000..e9d51ad --- /dev/null +++ b/Porting/corelist.pl @@ -0,0 +1,35 @@ +#!perl +# Generates info for Module::CoreList from this perl tree +# run this from the root of a clean perl tree + +use 5.9.0; +use strict; +use warnings; +use File::Find; +use ExtUtils::MM_Unix; + +my @lines; +find(sub { + /(\.pm|_pm\.PL)$/ or return; + /PPPort_pm\.PL/ and return; + my $module = $File::Find::name; + $module =~ /\b(demo|t)\b/ and return; # demo or test modules + my $version = MM->parse_version($_) // 'undef'; + $version =~ /\d/ and $version = "'$version'"; + # some heuristics to figure out the module name from the file name + $module =~ s{^(lib|ext)/}{} + and $1 eq 'ext' + and ( $module =~ s{^(.*)/lib/\1\b}{$1}, + $module =~ s{(\w+)/\1\b}{$1}, + $module =~ s{^Encode/encoding}{encoding}, + $module =~ s{^MIME/Base64/QuotedPrint}{MIME/QuotedPrint}, + $module =~ s{^List/Util/lib/Scalar}{Scalar}, + $module =~ s{^(?:DynaLoader|Errno)/}{}, + ); + $module =~ s{/}{::}g; + $module =~ s/(\.pm|_pm\.PL)$//; + push @lines, sprintf "\t%-24s=> $version,\n", "'$module'"; +}, 'lib', 'ext'); +print " $] => {\n"; +print sort @lines; +print " },\n";