| 1 | package App::PDRUtils::DistIniCmd::list_prereqs; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | our $DATE = '2021-05-25'; # DATE | |||||||||||||||||||||||||||
| 4 | 2 | our $VERSION = '0.122'; # VERSION | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use 5.010001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Log::ger; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use App::PDRUtils::Cmd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use App::PDRUtils::DistIniCmd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | our %SPEC; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | $SPEC{handle_cmd} = { | ||||||||||||||||||||||||||||
| 17 | 2 | v => 1.1, | |||||||||||||||||||||||||||
| 18 | summary => 'List prereqs from `[Prereqs/*]` sections', | ||||||||||||||||||||||||||||
| 19 | description => <<'_', | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | This command list prerequisites found in `[Prereqs/*]` sections in your | ||||||||||||||||||||||||||||
| 22 | `dist.ini`. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | _ | ||||||||||||||||||||||||||||
| 25 | args => { | ||||||||||||||||||||||||||||
| 26 | %App::PDRUtils::DistIniCmd::common_args, | ||||||||||||||||||||||||||||
| 27 | module => { | ||||||||||||||||||||||||||||
| 28 | summary => 'Module name', | ||||||||||||||||||||||||||||
| 29 | schema => ['perl::modname*'], | ||||||||||||||||||||||||||||
| 30 | tags => ['category:filtering'], | ||||||||||||||||||||||||||||
| 31 | }, | ||||||||||||||||||||||||||||
| 32 | phase => { | ||||||||||||||||||||||||||||
| 33 | schema => ['str*', in=>[qw/configure build test runtime develop/]], | ||||||||||||||||||||||||||||
| 34 | tags => ['category:filtering'], | ||||||||||||||||||||||||||||
| 35 | }, | ||||||||||||||||||||||||||||
| 36 | rel => { | ||||||||||||||||||||||||||||
| 37 | schema => ['str*', in=>[qw/requires recommends suggests conflicts/]], | ||||||||||||||||||||||||||||
| 38 | tags => ['category:filtering'], | ||||||||||||||||||||||||||||
| 39 | }, | ||||||||||||||||||||||||||||
| 40 | detail => { | ||||||||||||||||||||||||||||
| 41 | schema => 'bool', | ||||||||||||||||||||||||||||
| 42 | cmdline_aliases => {l=>{}}, | ||||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||
| 44 | }, | ||||||||||||||||||||||||||||
| 45 | }; | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub handle_cmd { | ||||||||||||||||||||||||||
|
Subroutine
handle_cmd: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 0 | my %fargs = @_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | my $iod = $fargs{parsed_dist_ini}; | |||||||||||||||||||||||||||
| 50 | 0 | my $hoh = $iod->dump; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | my @res; | |||||||||||||||||||||||||||
| 53 | 0 | for my $sect (sort keys %$hoh) { | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | next unless $sect =~ m!\A | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | Prereqs | ||||||||||||||||||||||||||||
| 56 | (?:\s*/\s*(.+))? | ||||||||||||||||||||||||||||
| 57 | \z!x; | ||||||||||||||||||||||||||||
| 58 | 0 | my $plugin_name = $1; | |||||||||||||||||||||||||||
| 59 | 0 | my ($phase, $rel); | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ($plugin_name && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$plugin_name and $plugin_name =~ /\A(Configure|Build|Test|Runtime|Develop)
(Requires|Recommends|Suggests|Conflicts)\z/x
MC/DC0%0/2
$plugin_name and $plugin_name =~ /\A(Configure|Build|Test|Runtime|Develop)
(Requires|Recommends|Suggests|Conflicts)\z/x
$plugin_name
$plugin_name =~ /\A(Configure|Build|Test|Runtime|Develop)
(Requires|Recommends|Suggests|Conflicts)\z/x
Truth table0%0/3
A and B
A= $plugin_nameB= $plugin_name =~ /\A(Configure|Build|Test|Runtime|Develop)
(Requires|Recommends|Suggests|Conflicts)\z/x
| |||||||||||||||||||||||||||||
| 61 | $plugin_name =~ /\A(Configure|Build|Test|Runtime|Develop) | ||||||||||||||||||||||||||||
| 62 | (Requires|Recommends|Suggests|Conflicts)\z/x) { | ||||||||||||||||||||||||||||
| 63 | 0 | $phase = $1; | |||||||||||||||||||||||||||
| 64 | 0 | $rel = $2; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | my $prereqs = $hoh->{$sect}; | |||||||||||||||||||||||||||
| 68 | 0 | for (keys %$prereqs) { | |||||||||||||||||||||||||||
| 69 | 0 | ▶ | if (/^-phase$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | $phase = delete $prereqs->{$_}; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if (/^-(relationship|type)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | $rel = delete $prereqs->{$_}; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $phase //= "runtime"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$phase //= "runtime"
MC/DC0%0/1
$phase //= "runtime"
$phase
Truth table0%0/2
A
A= $phase
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $rel //= "requires"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$rel //= "requires"
MC/DC0%0/1
$rel //= "requires"
$rel
Truth table0%0/2
A
A= $rel
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (defined $fargs{phase}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | next unless lc($fargs{phase}) eq lc($phase); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if (defined $fargs{rel}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | next unless lc($fargs{rel}) eq lc($rel); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | for my $mod (sort keys %$prereqs) { | |||||||||||||||||||||||||||
| 88 | 0 | my $version = $prereqs->{$mod}; | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | if (defined $fargs{module}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | next unless $fargs{module} eq $mod; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | 0 | push @res, { | |||||||||||||||||||||||||||
| 93 | module => $mod, | ||||||||||||||||||||||||||||
| 94 | version => $version, | ||||||||||||||||||||||||||||
| 95 | phase => lc $phase, | ||||||||||||||||||||||||||||
| 96 | rel => lc $rel, | ||||||||||||||||||||||||||||
| 97 | }; | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ($fargs{detail}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | return [304, "Not modified", $iod, { | |||||||||||||||||||||||||||
| 103 | 'func.result' => \@res, | ||||||||||||||||||||||||||||
| 104 | 'table.fields' => [qw/module version phase rel/], | ||||||||||||||||||||||||||||
| 105 | }]; | ||||||||||||||||||||||||||||
| 106 | } else { | ||||||||||||||||||||||||||||
| 107 | 0 | @res = map { $_->{module} } @res; | |||||||||||||||||||||||||||
| 108 | 0 | return [304, "Not modified", $iod, { | |||||||||||||||||||||||||||
| 109 | 'func.result' => \@res, | ||||||||||||||||||||||||||||
| 110 | }]; | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 2 | 1; | |||||||||||||||||||||||||||
| 115 | # ABSTRACT: List prereqs from `[Prereqs/*]` sections | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | __END__ | ||||||||||||||||||||||||||||