App-DistUtils
view release on metacpan or search on metacpan
script/packlist-for view on Meta::CPAN
#!perl
use 5.010;
use strict;
use warnings;
use Perinci::CmdLine::Any;
use Perinci::Object;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-05-20'; # DATE
our $DIST = 'App-DistUtils'; # DIST
our $VERSION = '0.154'; # VERSION
our %SPEC;
$SPEC{packlist_for} = {
v => 1.1,
summary => 'Locate .packlist for a Perl module',
args => {
module => {
schema => ['array*', of=>'perl::modname*', min_len=>1],
req => 1,
pos => 0,
greedy => 1,
element_completion => sub {
require Complete::Module;
my %args = @_;
Complete::Module::complete_module(word=>$args{word});
},
},
},
};
sub packlist_for {
require Dist::Util;
my %args = @_;
my $mods = $args{module};
my @res;
my $envres = envresmulti([200,"OK",\@res]);
for my $mod (@$mods) {
$mod =~ s!(-|/)!::!g;
my $packlist = Dist::Util::packlist_for($mod);
if (defined $packlist) {
$envres->add_result(200, "OK", {item_id=>$mod});
push @res, @$mods > 1 ?
{module=>$mod, packlist=>$packlist} :
$packlist;
} else {
$envres->add_result(404, "Not found", {item_id=>$mod});
}
}
$envres->as_struct;
}
Perinci::CmdLine::Any->new(
url => "/main/packlist_for",
)->run;
# ABSTRACT: Locate .packlist for a Perl module
# PODNAME: packlist-for
__END__
=pod
=encoding UTF-8
=head1 NAME
packlist-for - Locate .packlist for a Perl module
=head1 VERSION
This document describes version 0.154 of packlist-for (from Perl distribution App-DistUtils), released on 2023-05-20.
=head1 SYNOPSIS
% packlist-for Text::ANSITable Foo
Text::ANSITable: /home/steven/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/x86_64-linux/auto/Text/ANSITable/.packlist
packlist for Foo not found
=head1 DESCRIPTION
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--module-json>=I<s>
See C<--module>.
Can also be specified as the 1st command-line argument and onwards.
=item B<--module>=I<s@>*
(No description)
Can also be specified as the 1st command-line argument and onwards.
Can be specified multiple times.
=back
=head2 Configuration options
( run in 0.763 second using v1.01-cache-2.11-cpan-39bf76dae61 )