| 1 | package App::lcpan::Cmd::rdeps_from_other_author; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 1 | require App::lcpan; | |||||||||||||
| 8 | 1 | ▶ | use Perinci::Sub::Util qw(gen_modified_sub); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||
| 11 | 1 | our $DATE = '2023-09-26'; # DATE | |||||||||||||
| 12 | 1 | our $DIST = 'App-lcpan'; # DIST | |||||||||||||
| 13 | 1 | our $VERSION = '1.074'; # VERSION | |||||||||||||
| 14 | |||||||||||||||
| 15 | 1 | our %SPEC; | |||||||||||||
| 16 | |||||||||||||||
| 17 | gen_modified_sub( | ||||||||||||||
| 18 | base_name => 'App::lcpan::rdeps', | ||||||||||||||
| 19 | output_name => 'handle_cmd', | ||||||||||||||
| 20 | remove_args => ['authors', 'authors_arent'], | ||||||||||||||
| 21 | summary => 'List reverse dependencies from distributions of other authors', | ||||||||||||||
| 22 | 0 | ▶ | output_code => sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||
| 23 | 0 | my %args = @_; | |||||||||||||
| 24 | |||||||||||||||
| 25 | 0 | my $state = App::lcpan::_init(\%args, 'ro'); | |||||||||||||
| 26 | 0 | my $dbh = $state->{dbh}; | |||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | my @authors; | |||||||||||||
| 29 | 0 | ▶ | if ($args{modules}) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 30 | my $sth = $dbh->prepare( | ||||||||||||||
| 31 | "SELECT DISTINCT cpanid FROM module WHERE name IN (". | ||||||||||||||
| 32 | 0 | join(", ", map { $dbh->quote($_) } @{ $args{modules} }).")"); | |||||||||||||
| 33 | 0 | $sth->execute; | |||||||||||||
| 34 | 0 | ▶ | while (my @row = $sth->fetchrow_array) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 35 | 0 | push @authors, $row[0]; | |||||||||||||
| 36 | } | ||||||||||||||
| 37 | 0 | $sth->finish; | |||||||||||||
| 38 | 0 | ▶ | return [404, "No such module(s)"] unless @authors; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 39 | } elsif ($args{dists}) { | ||||||||||||||
| 40 | my $sth = $dbh->prepare( | ||||||||||||||
| 41 | "SELECT DISTINCT cpanid FROM file WHERE dist_name IN (". | ||||||||||||||
| 42 | 0 | join(", ", map { $dbh->quote($_) } @{ $args{dists} }).")"); | |||||||||||||
| 43 | 0 | $sth->execute; | |||||||||||||
| 44 | 0 | ▶ | while (my @row = $sth->fetchrow_array) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 45 | 0 | push @authors, $row[0]; | |||||||||||||
| 46 | } | ||||||||||||||
| 47 | 0 | $sth->finish; | |||||||||||||
| 48 | 0 | ▶ | return [404, "No such dist(s)"] unless @authors; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 49 | } else { | ||||||||||||||
| 50 | 0 | return [400, "Please specify either modules/dists"]; | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | 0 | App::lcpan::rdeps( | |||||||||||||
| 54 | %args, | ||||||||||||||
| 55 | authors_arent => \@authors, | ||||||||||||||
| 56 | ); | ||||||||||||||
| 57 | }, | ||||||||||||||
| 58 | 1 | ); | |||||||||||||
| 59 | |||||||||||||||
| 60 | 1 | 1; | |||||||||||||
| 61 | # ABSTRACT: List reverse dependencies from distributions of other authors | ||||||||||||||
| 62 | |||||||||||||||
| 63 | __END__ | ||||||||||||||