public
Created

Reports the names of CPAN distributions installed on the current Perl.

  • Download Gist
perl-popcon.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
use v5.10;
use strict;
use warnings;
 
use aliased "Path::Tiny" => "Path";
use aliased "Path::Iterator::Rule";
use aliased "JSON";
 
my @dists;
 
my $rule = Rule->new->file->name(".packlist");
 
for my $inc (@INC)
{
my $auto = Path->new($inc)->child("auto");
my $iter = $rule->iter($auto);
while (my $f = $iter->())
{
my $file = Path->new($f);
my $dist = $file->relative($auto);
next unless $dist =~ s{.\.packlist$}{};
$dist =~ s{/}{-}g;
push @dists, $dist;
}
}
 
print JSON->new->pretty(1)->canonical(1)->encode({
distributions => [sort @dists],
perl_version => "$^V",
platform => "$^O",
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.