Last active
August 29, 2015 14:03
-
-
Save dolmen/ec5d797d3fc694746c4c to your computer and use it in GitHub Desktop.
A filter for a list of Perl 5 modules, that will remove pure core modules such as 'integer'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use Module::CoreList 2.99; | |
use Getopt::Long; | |
my $verbose; # --verbose | |
my $invert = 0; # -v, like grep | |
GetOptions( | |
'verbose' => \$verbose, | |
'v|invert-match' => \$invert, | |
); | |
# perl -MModule::CoreList -E 'say for sort keys $Module::CoreList::version{$]}' | corelist-filter --verbose | |
while (<STDIN>) | |
{ | |
chomp(my $module = $_); | |
# FIXME | |
# This check is not enough and Module::CoreList doesn't have enough | |
# information about dual-life state of a module | |
# Another source of information: the ext/ directory of perl source, | |
# but it lists only distributions. | |
# http://perl5.git.perl.org/perl.git/tree/HEAD:/ext | |
# According to BinGOs, the only way is to check if the module is not | |
# in 02packages.details.txt | |
my $matches = | |
$Module::CoreList::version{$]}{$module} | |
&& ! exists $Module::CoreList::upstream{$module}; | |
if ($matches xor $invert) { | |
print STDERR "skipping $_" if $verbose | |
} else { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment