App/lcpan/Cmd/deps_to_other_author.pm

filter: Statementstmt 46.3% 19 / 41 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 38.9% 23 / 59 CC 6 SCAR 32.4
CC
6
Cov
37%
__ANON__
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 25.6
« App/lcpan/Cmd/dist_meta.pm ↑ Summary App/lcpan/Cmd/mentions_for_all_mods.pm »
1 package App::lcpan::Cmd::deps_to_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::deps',
19 output_name => 'handle_cmd',
20 summary => 'List dependencies to modules of other authors',
21 0 ▶ output_code => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
22 0 my %args = @_;
23  
24 0 my $state = App::lcpan::_init(\%args, 'ro');
25 0 my $dbh = $state->{dbh};
26  
27 0 my @authors;
28 0 ▶ if ($args{dists}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'dists'}) { } 0 0 0
29 my $sth = $dbh->prepare(
30 "SELECT DISTINCT cpanid FROM file WHERE dist_name IN (".
31 0 join(", ", map { $dbh->quote($_) } @{ $args{dists} }).")");
32 0 $sth->execute;
33 0 ▶ while (my @row = $sth->fetchrow_array) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@row) = $sth->fetchrow_array) 0 0 0
34 0 push @authors, $row[0];
35 }
36 0 $sth->finish;
37 0 ▶ return [404, "No such dist(s)"] unless @authors;
Branch: 1 branch
BranchTrueFalseTotal
unless @authors 0 0 0
38 } else {
39 0 return [400, "Please specify dists"];
40 }
41  
42 0 my $res = App::lcpan::deps(%args);
43 0 ▶ return $res unless $res->[0] == 200;
Branch: 1 branch
BranchTrueFalseTotal
unless $res->[0] == 200 0 0 0
44  
45 0 ▶ $res->[2] = [grep { my $author = $_->{author}; !defined($author) || !(grep {$author eq $_} @authors) } @{ $res->[2] }];
Condition0%0/3
defined $author && grep({$author eq $_;} @authors)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $author && grep({$author eq $_;} @authors)
defined $author grep({$author eq $_;} @authors)
Truth table0%0/3
A && B
A= defined $authorB= grep({$author eq $_;} @authors)
ABresult
0X0
100
111
46 0 $res;
47 },
48 1 );
49  
50 1 1;
51 # ABSTRACT: List dependencies to modules of other authors
52  
53 __END__
« App/lcpan/Cmd/dist_meta.pm ↑ Summary App/lcpan/Cmd/mentions_for_all_mods.pm »