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 --diff PerlVersion PerlVersion
25 lists all versions of the given module (or the matching modules, in case you
26 used a module regexp) in the perls Module::CoreList knows about.
30 Unicode was first released with perl v5.6.2
79 finds the first perl version where a module has been released by
80 date, and not by version number (as is the default).
84 Given two versions of perl, this prints a human-readable table of all module
85 changes between the two. The output format may change in the future, and is
86 meant for I<humans>, not programs. For programs, use the L<Module::CoreList>
91 help! help! help! to see more help, try --man.
99 lists all of the perl release versions we got the CoreList for.
101 If you pass a version argument (value of C<$]>, like C<5.00503> or C<5.008008>),
102 you get a list of all the modules and their respective versions.
103 (If you have the C<version> module, you can also use new-style version numbers,
106 In module filtering context, it can be used as Perl version filter.
110 lists all of the perl releases and when they were released
112 If you pass a perl version you get the release date for that version only.
116 As a special case, if you specify the module name C<Unicode>, you'll get
117 the version number of the Unicode Character Database bundled with the
118 requested perl versions.
122 use Module::CoreList;
127 use List::Util qw/maxstr/;
133 qw[ help|?! man! r|release:s v|version:s a! d diff|D ]
136 pod2usage(1) if $Opts{help};
137 pod2usage(-verbose=>2) if $Opts{man};
139 if(exists $Opts{r} ){
141 print "\nModule::CoreList has release info for the following perl versions:\n";
143 my $max_ver_len = max_mod_len(\%Module::CoreList::released);
144 for my $ver ( sort keys %Module::CoreList::released ) {
145 printf "%-${max_ver_len}s %s\n", format_perl_version($ver), $Module::CoreList::released{$ver};
151 my $num_r = numify_version( $Opts{r} );
152 my $version_hash = Module::CoreList->find_version($num_r);
154 if( !$version_hash ) {
155 print "\nModule::CoreList has no info on perl $Opts{r}\n\n";
159 printf "Perl %s was released on %s\n\n", format_perl_version($num_r), $Module::CoreList::released{$num_r};
163 if(exists $Opts{v} ){
165 print "\nModule::CoreList has info on the following perl versions:\n";
166 print format_perl_version($_)."\n" for sort keys %Module::CoreList::version;
171 my $num_v = numify_version( $Opts{v} );
172 my $version_hash = Module::CoreList->find_version($num_v);
174 if( !$version_hash ) {
175 print "\nModule::CoreList has no info on perl $Opts{v}\n\n";
180 print "\nThe following modules were in perl $Opts{v} CORE\n";
181 my $max_mod_len = max_mod_len($version_hash);
182 for my $mod ( sort keys %$version_hash ) {
183 printf "%-${max_mod_len}s %s\n", $mod, $version_hash->{$mod} || "";
192 die "\nprovide exactly two perl core versions to diff with --diff\n";
195 my ($old_ver, $new_ver) = @ARGV;
197 my $old = numify_version($old_ver);
198 my $new = numify_version($new_ver);
200 my %diff = Module::CoreList::changes_between($old, $new);
202 for my $lib (sort keys %diff) {
203 my $diff = $diff{$lib};
205 my $was = ! exists $diff->{left} ? '(absent)'
206 : ! defined $diff->{left} ? '(undef)'
209 my $now = ! exists $diff->{right} ? '(absent)'
210 : ! defined $diff->{right} ? '(undef)'
213 printf "%-35s %10s %10s\n", $lib, $was, $now;
224 if ($ARGV[0] =~ /=/) {
225 ($mod, $ver) = split /=/, shift @ARGV;
228 $ver = (@ARGV && $ARGV[0] =~ /^\d/) ? shift @ARGV : "";
231 if ($mod !~ m|^/(.*)/([imosx]*)$|) { # not a regex
232 module_version($mod,$ver);
235 eval { $re = $2 ? qr/(?$2)($1)/ : qr/$1/; }; # trap exceptions while building regex
237 # regex errors are usually like 'Quantifier follow nothing in regex; marked by ...'
238 # then we drop text after ';' to shorten message
239 my $errmsg = $@ =~ /(.*);/ ? $1 : $@;
240 warn "\n$mod is a bad regex: $errmsg\n";
243 my @mod = Module::CoreList->find_modules($re);
245 module_version($_, $ver) for @mod;
248 print "\n$mod $ver has no match in CORE (or so I think)\n";
260 my $numeric_v = numify_version($Opts{v});
261 my $version_hash = Module::CoreList->find_version($numeric_v);
263 print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
266 else { die "Shouldn't happen" }
270 ? Module::CoreList->first_release_by_date(@_)
271 : Module::CoreList->first_release(@_);
273 $msg .= " $ver" if $ver;
276 ? Module::CoreList->removed_from_by_date($mod)
277 : Module::CoreList->removed_from($mod);
279 my $when = maxstr(values %Module::CoreList::released);
280 print "\n","Data for $when\n";
283 my $deprecated = Module::CoreList->deprecated_in($mod);
285 $msg .= "first " unless $ver;
286 $msg .= "released with perl " . format_perl_version($ret);
287 $msg .= ( $rem ? ',' : ' and' ) . " deprecated in " . format_perl_version($deprecated) if $deprecated;
288 $msg .= " and removed from " . format_perl_version($rem) if $rem;
290 $msg .= " was not in CORE (or so I think)";
295 if(defined $ret and exists $Opts{a} and $Opts{a}){
302 my $versions = shift;
304 for my $mod (keys %$versions) {
305 $max = max($max, length $mod);
312 my($this, $that) = @_;
313 return $this if $this > $that;
320 for my $v (grep !/000$/, sort keys %Module::CoreList::version ) {
321 next unless exists $Module::CoreList::version{$v}{$mod};
323 my $mod_v = $Module::CoreList::version{$v}{$mod} || 'undef';
324 printf " %-10s %-10s\n", format_perl_version($v), $mod_v;
332 sub have_version_pm {
333 return $have_version_pm if defined $have_version_pm;
334 return $have_version_pm = eval { require version; 1 };
339 sub format_perl_version {
341 return $v if $v < 5.006 or !have_version_pm;
342 return version->new($v)->normal;
348 if ($ver =~ /\..+\./) {
350 or die "You need to install version.pm to use dotted version numbers\n";
351 $ver = version->new($ver)->numify;
359 $ corelist File::Spec
361 File::Spec was first released with perl 5.005
363 $ corelist File::Spec 0.83
365 File::Spec 0.83 was released with perl 5.007003
367 $ corelist File::Spec 0.89
369 File::Spec 0.89 was not in CORE (or so I think)
371 $ corelist File::Spec::Aliens
373 File::Spec::Aliens was not in CORE (or so I think)
375 $ corelist /IPC::Open/
377 IPC::Open2 was first released with perl 5
379 IPC::Open3 was first released with perl 5
381 $ corelist /MANIFEST/i
383 ExtUtils::Manifest was first released with perl 5.001
385 $ corelist /Template/
387 /Template/ has no match in CORE (or so I think)
389 $ corelist -v 5.8.8 B
393 $ corelist -v 5.8.8 /^B::/
415 Copyright (c) 2002-2007 by D.H. aka PodMaster
417 Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.
419 This program is distributed under the same terms as perl itself.
420 See http://perl.org/ or http://cpan.org/ for more info on that.