From bb97d99d1aa2aaf38bda050c693e1dab56fc7bc6 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Sat, 27 Nov 2010 16:44:47 -0500 Subject: [PATCH 1/2] newer core plugin, adds removed --- plugins/core.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/core.pm b/plugins/core.pm index 523506a..e3cb36e 100644 --- a/plugins/core.pm +++ b/plugins/core.pm @@ -1,12 +1,17 @@ use Module::CoreList; -no warnings 'void'; sub { my( $said, $pm ) = @_; my $module = $said->{recommended_args}->[0]; my $rev = Module::CoreList->first_release( $module ); - if( $rev ) { print "Added to perl core as of $rev" } + if( $rev ) { + print "Added to perl core as of $rev"; + if ( Module::CoreList->can('removed_from') ) { + my $rem = Module::CoreList->removed_from( $module ); + print " and removed from $rem" if $rem; + } + } else { my @modules = Module::CoreList->find_modules(qr/$module/); @@ -20,7 +25,7 @@ sub { else { print "Module $module does not appear to be in core. Perhaps capitalization matters or try using the 'cpan' command to search for it." } } -}; +} __DATA__ Tells you when the module you searched for was added to the Perl Core, if it was. From 336b7970e9ca1b89f34ed1c4f1a1e2871a7f4f14 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Sat, 27 Nov 2010 17:04:36 -0500 Subject: [PATCH 2/2] modified core.pm --- plugins/core.pm | 60 ++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/plugins/core.pm b/plugins/core.pm index e3cb36e..4a51d14 100644 --- a/plugins/core.pm +++ b/plugins/core.pm @@ -1,31 +1,45 @@ -use Module::CoreList; +BEGIN { + my ($filename) = "Module/CoreList.pm"; + my ( $realfilename, $result ); + ITER: { + foreach $prefix (@INC) { + $realfilename = "$prefix/$filename"; + if ( -f $realfilename ) { + $INC{$filename} = $realfilename; + $result = do $realfilename; + last ITER; + } + } + die "Can't find $filename in \@INC"; + } +} sub { - my( $said, $pm ) = @_; - my $module = $said->{recommended_args}->[0]; + my ( $said, $pm ) = @_; + my $module = $said->{recommended_args}->[0]; - my $rev = Module::CoreList->first_release( $module ); - if( $rev ) { - print "Added to perl core as of $rev"; - if ( Module::CoreList->can('removed_from') ) { - my $rem = Module::CoreList->removed_from( $module ); - print " and removed from $rem" if $rem; + my $rev = Module::CoreList->first_release($module); + if ($rev) { + print "Added to perl core as of $rev"; + if ( Module::CoreList->can('removed_from') ) { + my $rem = Module::CoreList->removed_from($module); + print " and removed from $rem" if $rem; + } + } + else { + my @modules = Module::CoreList->find_modules(qr/$module/); + + if (@modules) { + print 'Found', scalar @modules, ':', join ',', + map { $_ . ' in ' . Module::CoreList->first_release($_) } + @modules; + + } + else { + print "Module $module does not appear to be in core. Perhaps capitalization matters or try using the 'cpan' command to search for it."; + } } } - else { - - my @modules = Module::CoreList->find_modules(qr/$module/); - - if ( @modules ){ - - print 'Found', scalar @modules, ':', join ',' , - map {$_.' in '. Module::CoreList->first_release( $_ ) } @modules; - - } - else { - print "Module $module does not appear to be in core. Perhaps capitalization matters or try using the 'cpan' command to search for it." } - } -} __DATA__ Tells you when the module you searched for was added to the Perl Core, if it was.