App/lcpan/Cmd/rdeps_from_other_author.pm

filter: Statementstmt 45.2% 19 / 42 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 38.9% 23 / 59 CC 7 SCAR 35.8
CC
7
Cov
35%
__ANON__
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 36.0
« App/lcpan/Cmd/script2mod.pm ↑ Summary App/lcpan/PodParser.pm »
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
BranchTrueFalseTotal
if ($args{'modules'}) { } 0 0 0
elsif ($args{'dists'}) { } 0 0 0
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
BranchTrueFalseTotal
if (my(@row) = $sth->fetchrow_array) 0 0 0
35 0 push @authors, $row[0];
36 }
37 0 $sth->finish;
38 0 ▶ return [404, "No such module(s)"] unless @authors;
Branch: 1 branch
BranchTrueFalseTotal
unless @authors 0 0 0
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
BranchTrueFalseTotal
if (my(@row) = $sth->fetchrow_array) 0 0 0
45 0 push @authors, $row[0];
46 }
47 0 $sth->finish;
48 0 ▶ return [404, "No such dist(s)"] unless @authors;
Branch: 1 branch
BranchTrueFalseTotal
unless @authors 0 0 0
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__
« App/lcpan/Cmd/script2mod.pm ↑ Summary App/lcpan/PodParser.pm »