App-PerlbrewUtils
view release on metacpan or search on metacpan
bin/perlbrew-list-more view on Meta::CPAN
#!perl
our $DATE = '2016-06-02'; # DATE
our $VERSION = '0.04'; # VERSION
use 5.010001;
use strict;
use warnings;
use App::PerlbrewUtils;
use Perinci::CmdLine::Any;
our %SPEC;
$SPEC{list_more} = {
v => 1.1,
summary => 'List installed perls, but show more information',
args => {
%App::PerlbrewUtils::common_args,
},
};
sub list_more {
require App::perlbrew;
require File::Which;
require Module::CoreList::More;
my %args = @_;
my $probe_path = File::Which::which("__perlbrewutils-probe")
or return [412, "Can't find probe script __perlbrewutils-probe ".
"in PATH, make sure App::PerlbrewUtils has been ".
"installed first"];
my $pb = App::perlbrew->new;
my @perls = $pb->installed_perls;
my @res;
my %resmeta = ('table.fields' => [
qw/
name
is_current
version
threads multiplicity longdouble
num_modules num_core_modules num_noncore_modules
/]);
for my $perl (@perls) {
next unless App::PerlbrewUtils::_filter_perl($perl, \%args);
my $info_str = `$perl->{executable} $probe_path`;
my $info = eval $info_str;
next if $@;
my %core_modules = Module::CoreList::More->list_core_modules(
version->parse($perl->{version}));
my $num_core_modules = 0;
my $num_noncore_modules = 0;
for (keys %{$info->{modules}}) {
if (defined $core_modules{$_}) {
$num_core_modules++;
} else {
$num_noncore_modules++;
}
}
push @res, {
name => $perl->{name},
is_current => $perl->{is_current} ? 1:'',
version => $perl->{version},
threads => $info->{usethreads},
multiplicity => $info->{usemultiplicity},
longdouble => $info->{uselongdouble},
num_modules => scalar(keys %{$info->{modules}}),
num_core_modules => $num_core_modules,
num_noncore_modules => $num_noncore_modules,
};
}
[200, "OK", \@res, \%resmeta];
}
Perinci::CmdLine::Any->new(
url => '/main/list_more',
)->run;
# ABSTRACT: List installed perls, but show more information
# PODNAME: perlbrew-list-more
__END__
=pod
=encoding UTF-8
=head1 NAME
perlbrew-list-more - List installed perls, but show more information
=head1 VERSION
This document describes version 0.04 of perlbrew-list-more (from Perl distribution App-PerlbrewUtils), released on 2016-06-02.
=head1 SYNOPSIS
Usage:
% perlbrew-list-more [options]
=head1 DESCRIPTION
Like `perlbrew list` but show more information for each perl: number of
installed modules, number of installed core & non-core modules.
=head1 OPTIONS
C<*> marks required options.
=head2 Configuration options
=over
=item B<--config-path>=I<filename>
Set path to configuration file.
Can be specified multiple times.
=item B<--config-profile>=I<s>
Set configuration profile to use.
( run in 2.345 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )