Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Reports the names of CPAN distributions installed on the current Perl.
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",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.