App-lcpan
view release on metacpan or search on metacpan
lib/App/lcpan/Cmd/rdeps_from_other_author.pm view on Meta::CPAN
package App::lcpan::Cmd::rdeps_from_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::rdeps',
output_name => 'handle_cmd',
remove_args => ['authors', 'authors_arent'],
summary => 'List reverse dependencies from distributions of other authors',
output_code => sub {
my %args = @_;
my $state = App::lcpan::_init(\%args, 'ro');
my $dbh = $state->{dbh};
my @authors;
if ($args{modules}) {
my $sth = $dbh->prepare(
"SELECT DISTINCT cpanid FROM module WHERE name IN (".
join(", ", map { $dbh->quote($_) } @{ $args{modules} }).")");
$sth->execute;
while (my @row = $sth->fetchrow_array) {
push @authors, $row[0];
}
$sth->finish;
return [404, "No such module(s)"] unless @authors;
} elsif ($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 either modules/dists"];
}
App::lcpan::rdeps(
%args,
authors_arent => \@authors,
);
},
);
1;
# ABSTRACT: List reverse dependencies from distributions of other authors
__END__
=pod
=encoding UTF-8
=head1 NAME
App::lcpan::Cmd::rdeps_from_other_author - List reverse dependencies from distributions of other authors
=head1 VERSION
This document describes version 1.074 of App::lcpan::Cmd::rdeps_from_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 reverse dependencies from distributions of other authors.
Examples:
=over
=item * List what distributions depend on Sah::Schema::filename:
handle_cmd(modules => ["Sah::Schema::filename"]);
=item * List what distributions depend on one of the modules in Sah-Schemas-Path:
handle_cmd(dists => ["Sah-Schemas-Path"]);
=back
This function is not exported.
Arguments ('*' denotes required arguments):
=over 4
=item * B<added_or_updated_since> => I<date>
( run in 1.583 second using v1.01-cache-2.11-cpan-5a3173703d6 )