5 corelist - a commandline frontend to Module::CoreList
9 See L<Module::CoreList> for one.
14 corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
15 corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
16 corelist [-r <PerlVersion>] ...
17 corelist --feature <FeatureName> [<FeatureName>] ...
18 corelist --diff PerlVersion PerlVersion
19 corelist --upstream <ModuleName>
27 lists all versions of the given module (or the matching modules, in case you
28 used a module regexp) in the perls Module::CoreList knows about.
32 Unicode was first released with perl v5.6.2
81 finds the first perl version where a module has been released by
82 date, and not by version number (as is the default).
86 Given two versions of perl, this prints a human-readable table of all module
87 changes between the two. The output format may change in the future, and is
88 meant for I<humans>, not programs. For programs, use the L<Module::CoreList>
93 help! help! help! to see more help, try --man.
101 lists all of the perl release versions we got the CoreList for.
103 If you pass a version argument (value of C<$]>, like C<5.00503> or C<5.008008>),
104 you get a list of all the modules and their respective versions.
105 (If you have the C<version> module, you can also use new-style version numbers,
108 In module filtering context, it can be used as Perl version filter.
112 lists all of the perl releases and when they were released
114 If you pass a perl version you get the release date for that version only.
118 lists the first version bundle of each named feature given
122 Shows if the given module is primarily maintained in perl core or on CPAN
127 As a special case, if you specify the module name C<Unicode>, you'll get
128 the version number of the Unicode Character Database bundled with the
129 requested perl versions.
133 use Module::CoreList;
134 use Getopt::Long qw(:config no_ignore_case);
138 use List::Util qw/maxstr/;
144 qw[ help|?! man! r|release:s v|version:s a! d diff|D feature|f u|upstream ]
147 pod2usage(1) if $Opts{help};
148 pod2usage(-verbose=>2) if $Opts{man};
150 if(exists $Opts{r} ){
152 print "\nModule::CoreList has release info for the following perl versions:\n";
154 my $max_ver_len = max_mod_len(\%Module::CoreList::released);
155 for my $ver ( grep !/0[01]0$/, sort keys %Module::CoreList::released ) {
156 printf "%-${max_ver_len}s %s\n", format_perl_version($ver), $Module::CoreList::released{$ver};
162 my $num_r = numify_version( $Opts{r} );
163 my $version_hash = Module::CoreList->find_version($num_r);
165 if( !$version_hash ) {
166 print "\nModule::CoreList has no info on perl $Opts{r}\n\n";
170 printf "Perl %s was released on %s\n\n", format_perl_version($num_r), $Module::CoreList::released{$num_r};
174 if(exists $Opts{v} ){
176 print "\nModule::CoreList has info on the following perl versions:\n";
177 print format_perl_version($_)."\n" for grep !/0[01]0$/, sort keys %Module::CoreList::version;
182 my $num_v = numify_version( $Opts{v} );
183 my $version_hash = Module::CoreList->find_version($num_v);
185 if( !$version_hash ) {
186 print "\nModule::CoreList has no info on perl $Opts{v}\n\n";
191 print "\nThe following modules were in perl $Opts{v} CORE\n";
192 my $max_mod_len = max_mod_len($version_hash);
193 for my $mod ( sort keys %$version_hash ) {
194 printf "%-${max_mod_len}s %s\n", $mod, $version_hash->{$mod} || "";
203 die "\nprovide exactly two perl core versions to diff with --diff\n";
206 my ($old_ver, $new_ver) = @ARGV;
208 my $old = numify_version($old_ver);
209 my $new = numify_version($new_ver);
211 my %diff = Module::CoreList::changes_between($old, $new);
213 for my $lib (sort keys %diff) {
214 my $diff = $diff{$lib};
216 my $was = ! exists $diff->{left} ? '(absent)'
217 : ! defined $diff->{left} ? '(undef)'
220 my $now = ! exists $diff->{right} ? '(absent)'
221 : ! defined $diff->{right} ? '(undef)'
224 printf "%-35s %10s %10s\n", $lib, $was, $now;
229 if ($Opts{feature}) {
230 die "\n--feature is only available with perl v5.16.0 or greater\n"
233 die "\nprovide at least one feature name to --feature\n"
240 my @bundles = map { $_->[0] }
241 sort { $b->[1] <=> $a->[1] }
242 map { [$_, numify_version($_)] }
243 grep { not /[^0-9.]/ }
244 keys %feature::feature_bundle;
246 for my $version (@bundles) {
247 $feature2version{$_} = $version =~ /^\d\.\d+$/ ? "$version.0" : $version
248 for @{ $feature::feature_bundle{$version} };
251 # allow internal feature names, just in case someone gives us __SUB__
252 # instead of current_sub.
253 while (my ($name, $internal) = each %feature::feature) {
254 $internal =~ s/^feature_//;
255 $feature2version{$internal} = $feature2version{$name}
256 if $feature2version{$name};
259 my $when = maxstr(values %Module::CoreList::released);
260 print "\n","Data for $when\n";
262 for my $feature (@ARGV) {
263 print "feature \"$feature\" ",
264 exists $feature2version{$feature}
265 ? "was first released with the perl "
266 . format_perl_version(numify_version($feature2version{$feature}))
267 . " feature bundle\n"
268 : "doesn't exist (or so I think)\n";
279 if ($ARGV[0] =~ /=/) {
280 ($mod, $ver) = split /=/, shift @ARGV;
283 $ver = (@ARGV && $ARGV[0] =~ /^\d/) ? shift @ARGV : "";
286 if ($mod !~ m|^/(.*)/([imosx]*)$|) { # not a regex
287 module_version($mod,$ver);
290 eval { $re = $2 ? qr/(?$2)($1)/ : qr/$1/; }; # trap exceptions while building regex
292 # regex errors are usually like 'Quantifier follow nothing in regex; marked by ...'
293 # then we drop text after ';' to shorten message
294 my $errmsg = $@ =~ /(.*);/ ? $1 : $@;
295 warn "\n$mod is a bad regex: $errmsg\n";
298 my @mod = Module::CoreList->find_modules($re);
300 module_version($_, $ver) for @mod;
303 print "\n$mod $ver has no match in CORE (or so I think)\n";
315 my $numeric_v = numify_version($Opts{v});
316 my $version_hash = Module::CoreList->find_version($numeric_v);
318 print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
321 else { die "Shouldn't happen" }
325 ? Module::CoreList->first_release_by_date(@_)
326 : Module::CoreList->first_release(@_);
328 $msg .= " $ver" if $ver;
331 ? Module::CoreList->removed_from_by_date($mod)
332 : Module::CoreList->removed_from($mod);
334 my $when = maxstr(values %Module::CoreList::released);
335 print "\n","Data for $when\n";
338 my $deprecated = Module::CoreList->deprecated_in($mod);
340 $msg .= "first " unless $ver;
341 $msg .= "released with perl " . format_perl_version($ret);
342 $msg .= ( $rem ? ',' : ' and' ) . " deprecated (will be CPAN-only) in " . format_perl_version($deprecated) if $deprecated;
343 $msg .= " and removed from " . format_perl_version($rem) if $rem;
345 $msg .= " was not in CORE (or so I think)";
350 if( defined $ret and exists $Opts{u} ) {
351 my $upsream = $Module::CoreList::upstream{$mod};
352 $upsream = 'undef' unless $upsream;
353 print "upstream: $upsream\n";
354 if ( $upsream ne 'blead' ) {
355 my $bugtracker = $Module::CoreList::bug_tracker{$mod};
356 $bugtracker = 'unknown' unless $bugtracker;
357 print "bug tracker: $bugtracker\n";
361 if(defined $ret and exists $Opts{a} and $Opts{a}){
368 my $versions = shift;
370 for my $mod (keys %$versions) {
371 $max = max($max, length $mod);
378 my($this, $that) = @_;
379 return $this if $this > $that;
386 for my $v (grep !/0[01]0$/, sort keys %Module::CoreList::version ) {
387 next unless exists $Module::CoreList::version{$v}{$mod};
389 my $mod_v = $Module::CoreList::version{$v}{$mod} || 'undef';
390 printf " %-10s %-10s\n", format_perl_version($v), $mod_v;
398 sub have_version_pm {
399 return $have_version_pm if defined $have_version_pm;
400 return $have_version_pm = eval { require version; 1 };
405 sub format_perl_version {
407 return $v if $v < 5.006 or !have_version_pm;
408 return version->new($v)->normal;
414 if ($ver =~ /\..+\./) {
416 or die "You need to install version.pm to use dotted version numbers\n";
417 $ver = version->new($ver)->numify;
425 $ corelist File::Spec
427 File::Spec was first released with perl 5.005
429 $ corelist File::Spec 0.83
431 File::Spec 0.83 was released with perl 5.007003
433 $ corelist File::Spec 0.89
435 File::Spec 0.89 was not in CORE (or so I think)
437 $ corelist File::Spec::Aliens
439 File::Spec::Aliens was not in CORE (or so I think)
441 $ corelist /IPC::Open/
443 IPC::Open2 was first released with perl 5
445 IPC::Open3 was first released with perl 5
447 $ corelist /MANIFEST/i
449 ExtUtils::Manifest was first released with perl 5.001
451 $ corelist /Template/
453 /Template/ has no match in CORE (or so I think)
455 $ corelist -v 5.8.8 B
459 $ corelist -v 5.8.8 /^B::/
481 Copyright (c) 2002-2007 by D.H. aka PodMaster
483 Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.
485 This program is distributed under the same terms as perl itself.
486 See http://perl.org/ or http://cpan.org/ for more info on that.