App-lcpan
view release on metacpan or search on metacpan
lib/App/lcpan/Cmd/deps_to_other_author.pm view on Meta::CPAN
package App::lcpan::Cmd::deps_to_other_author;
use 5.010;
use strict;
use warnings;
require App::lcpan;
use Perinci::Sub::Util qw(gen_modified_sub);
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-09-26'; # DATE
our $DIST = 'App-lcpan'; # DIST
our $VERSION = '1.074'; # VERSION
our %SPEC;
gen_modified_sub(
base_name => 'App::lcpan::deps',
output_name => 'handle_cmd',
summary => 'List dependencies to modules of other authors',
output_code => sub {
my %args = @_;
my $state = App::lcpan::_init(\%args, 'ro');
my $dbh = $state->{dbh};
my @authors;
if ($args{dists}) {
my $sth = $dbh->prepare(
"SELECT DISTINCT cpanid FROM file WHERE dist_name IN (".
join(", ", map { $dbh->quote($_) } @{ $args{dists} }).")");
$sth->execute;
while (my @row = $sth->fetchrow_array) {
push @authors, $row[0];
}
$sth->finish;
return [404, "No such dist(s)"] unless @authors;
} else {
return [400, "Please specify dists"];
}
my $res = App::lcpan::deps(%args);
return $res unless $res->[0] == 200;
$res->[2] = [grep { my $author = $_->{author}; !defined($author) || !(grep {$author eq $_} @authors) } @{ $res->[2] }];
$res;
},
);
1;
# ABSTRACT: List dependencies to modules of other authors
__END__
=pod
=encoding UTF-8
=head1 NAME
App::lcpan::Cmd::deps_to_other_author - List dependencies to modules of other authors
=head1 VERSION
This document describes version 1.074 of App::lcpan::Cmd::deps_to_other_author (from Perl distribution App-lcpan), released on 2023-09-26.
=head1 FUNCTIONS
=head2 handle_cmd
Usage:
handle_cmd(%args) -> [$status_code, $reason, $payload, \%result_meta]
List dependencies to modules of other authors.
Examples:
=over
=item * List what modules Module-List requires:
handle_cmd(dists => ["Module-List"]);
=item * List modules Module-List requires (module name will be converted to distro name):
handle_cmd(dists => ["Module::List"]);
=item * List what distribution that contains Sah::Schema::filename requires:
handle_cmd(modules => ["Sah::Schema::filename"]);
Sah::Schema::filename is included in Sah-Schemas-Path distribution, so this
command is equivalent to "lcpan deps Sah-Schemas-Path". You can't do "lcpan deps
Sah::Schema::filename" because C<lcpan> will assume that you ask "lcpan deps
Sah-Schema-filename" and there is no Sah-Schema-filename distribution.
( run in 2.366 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )