| 1 | package App::lcpan::Cmd::mentions_for_all_mods; | ||||||||||||
| 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 | 1 | ▶ | use Log::ger; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 1 | require App::lcpan; | |||||||||||
| 9 | 1 | require App::lcpan::Cmd::mentions_for_mod; | |||||||||||
| 10 | |||||||||||||
| 11 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||
| 12 | 1 | our $DATE = '2023-09-26'; # DATE | |||||||||||
| 13 | 1 | our $DIST = 'App-lcpan'; # DIST | |||||||||||
| 14 | 1 | our $VERSION = '1.074'; # VERSION | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | our %SPEC; | |||||||||||
| 17 | |||||||||||||
| 18 | 1 | my $mentions_for_mod_args = $App::lcpan::Cmd::mentions_for_mod::SPEC{handle_cmd}{args}; | |||||||||||
| 19 | |||||||||||||
| 20 | 1 | $SPEC{'handle_cmd'} = { | |||||||||||
| 21 | v => 1.1, | ||||||||||||
| 22 | summary => 'List PODs which mention all specified module(s)', | ||||||||||||
| 23 | description => <<'_', | ||||||||||||
| 24 | |||||||||||||
| 25 | This subcommand searches PODs that mention all of the specified modules. To | ||||||||||||
| 26 | search for PODs that mention *any* of the specified modules, see the | ||||||||||||
| 27 | `mentions-for-mods` subcommand. | ||||||||||||
| 28 | |||||||||||||
| 29 | _ | ||||||||||||
| 30 | args => $mentions_for_mod_args, | ||||||||||||
| 31 | }; | ||||||||||||
| 32 | 0 | ▶ | sub handle_cmd { | ||||||||||
|
Subroutine
handle_cmd: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||
| 33 | 0 | my %args = @_; | |||||||||||
| 34 | |||||||||||||
| 35 | 0 | my $mres = App::lcpan::Cmd::mentions_for_mod::handle_cmd(%args); | |||||||||||
| 36 | 0 | ▶ | return $mres unless $mres->[0] == 200; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | |||||||||||||
| 38 | 0 | my $mods = $args{modules}; | |||||||||||
| 39 | |||||||||||||
| 40 | 0 | my %counts; # key = content_path, value = hash of module name => count | |||||||||||
| 41 | my %content_data; # key = content_path, value = data | ||||||||||||
| 42 | 0 | for my $e (@{ $mres->[2] }) { | |||||||||||
| 43 | 0 | $counts{$e->{content_path}}{$e->{module}}++; | |||||||||||
| 44 | $content_data{$e->{content_path}} //= { | ||||||||||||
| 45 | release => $e->{release}, | ||||||||||||
| 46 | mentioner_author => $e->{mentioner_author}, | ||||||||||||
| 47 | content_path => $e->{content_path}, | ||||||||||||
| 48 | 0 | ▶ | }; | ||||||||||
|
Condition0%0/2
$content_data{$e->{"content_path"}} //= {"release", $e->{"release"}, "mentioner_author", $e->{"mentioner_author"}, "content_path", $e->{"content_path"}}
MC/DC0%0/1
$content_data{$e->{"content_path"}} //= {"release", $e->{"release"}, "mentioner_author", $e->{"mentioner_author"}, "content_path", $e->{"content_path"}}
$content_data{$e->{"content_path"}}
Truth table0%0/2
A
A= $content_data{$e->{"content_path"}}
| |||||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 0 | my $resmeta = {'table.fields' => [qw/content_path mentioner_author release/]}; | |||||||||||
| 52 | |||||||||||||
| 53 | 0 | my @res; | |||||||||||
| 54 | 0 | for my $cp (sort keys %counts) { | |||||||||||
| 55 | 0 | ▶ | next unless keys(%{ $counts{$cp} }) == @$mods; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | 0 | push @res, $content_data{$cp}; | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | 0 | [200, "OK", \@res, $resmeta]; | |||||||||||
| 60 | } | ||||||||||||
| 61 | |||||||||||||
| 62 | 1 | 1; | |||||||||||
| 63 | # ABSTRACT: List PODs which mention all specified module(s) | ||||||||||||
| 64 | |||||||||||||
| 65 | __END__ | ||||||||||||