| 1 | package App::CPANModulesUtils; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict 'subs', 'vars'; | ||||||||||||||||||
|
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 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||
| 9 | 1 | our $DATE = '2021-11-26'; # DATE | |||||||||||||||||||
| 10 | 1 | our $DIST = 'App-CPANModulesUtils'; # DIST | |||||||||||||||||||
| 11 | 1 | our $VERSION = '0.007'; # VERSION | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | our %SPEC; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | $SPEC{gen_acme_cpanmodules_module_from_acme_cpanlists_list} = { | ||||||||||||||||||||
| 16 | 1 | v => 1.1, | |||||||||||||||||||
| 17 | summary => 'Generate an Acme::CPANModules module file from an Acme::CPANLists module list', | ||||||||||||||||||||
| 18 | args => { | ||||||||||||||||||||
| 19 | input_module => { | ||||||||||||||||||||
| 20 | schema => 'perl::modname*', | ||||||||||||||||||||
| 21 | req => 1, | ||||||||||||||||||||
| 22 | pos => 0, | ||||||||||||||||||||
| 23 | description => <<'_', | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | "Acme::CPANLists::" will be prepended if module name does not begin with it. | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | _ | ||||||||||||||||||||
| 28 | }, | ||||||||||||||||||||
| 29 | input_list_index => { | ||||||||||||||||||||
| 30 | schema => 'nonnegint*', | ||||||||||||||||||||
| 31 | cmdline_aliases => {n=>{}}, | ||||||||||||||||||||
| 32 | description => <<'_', | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | Required if the Acme::CPANLists module contains more than one module list. | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | _ | ||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||
| 38 | output_module => { | ||||||||||||||||||||
| 39 | schema => 'perl::modname*', | ||||||||||||||||||||
| 40 | description => <<'_', | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | "Acme::CPANModules::" will be prepended if module name does not begin with it. | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | Will default to the Acme::CPANLists module name, with CPANLists replaced by | ||||||||||||||||||||
| 45 | CPANModules. | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | _ | ||||||||||||||||||||
| 48 | }, | ||||||||||||||||||||
| 49 | output_file => { | ||||||||||||||||||||
| 50 | schema => 'filename*', | ||||||||||||||||||||
| 51 | description => <<'_', | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | will default to "lib/Acme/CPANModules/<YourModuleName>.pm | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | _ | ||||||||||||||||||||
| 56 | #cmdline_aliases => {o=>{}}, | ||||||||||||||||||||
| 57 | }, | ||||||||||||||||||||
| 58 | overwrite => { | ||||||||||||||||||||
| 59 | schema => 'true*', | ||||||||||||||||||||
| 60 | cmdline_aliases => {O=>{}}, | ||||||||||||||||||||
| 61 | }, | ||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||
| 63 | }; | ||||||||||||||||||||
| 64 | 0 | ▶ | sub gen_acme_cpanmodules_module_from_acme_cpanlists_list { | ||||||||||||||||||
|
Subroutine
gen_acme_cpanmodules_module_from_acme_cpanlists_list: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||
| 65 | 0 | require Data::Dump; | |||||||||||||||||||
| 66 | 0 | require File::Path; | |||||||||||||||||||
| 67 | 0 | require File::Slurper; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | my %args = @_; | |||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 0 | my $input_module = $args{input_module}; | |||||||||||||||||||
| 72 | 0 | ▶ | $input_module = "Acme::CPANLists::$input_module" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | unless $input_module =~ /\AAcme::CPANLists::/; | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | ▶ | my $output_module = $args{output_module} // do { | ||||||||||||||||||
|
Condition0%0/3
$args{"output_module"} // do {
(my $val = $input_module) =~ s/CPANLists/CPANModules/;
$val
}
MC/DC0%0/2
$args{"output_module"} // do {
(my $val = $input_module) =~ s/CPANLists/CPANModules/;
$val
}
$args{"output_module"}
do {
(my $val = $input_module) =~ s/CPANLists/CPANModules/;
$val
}
Truth table0%0/3
A // B
A= $args{"output_module"}B= do {
(my $val = $input_module) =~ s/CPANLists/CPANModules/;
$val
}
| |||||||||||||||||||||
| 76 | 0 | (my $val = $input_module) =~ s/CPANLists/CPANModules/; | |||||||||||||||||||
| 77 | 0 | $val; | |||||||||||||||||||
| 78 | }; | ||||||||||||||||||||
| 79 | 0 | log_trace "output_module=$output_module"; | |||||||||||||||||||
| 80 | 0 | ▶ | $output_module = "Acme::CPANModules::$input_module" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | unless $output_module =~ /\AAcme::CPANModules::/; | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 0 | ▶ | my $output_file = $args{output_file} // do { | ||||||||||||||||||
|
Condition0%0/3
$args{"output_file"} // do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
MC/DC0%0/2
$args{"output_file"} // do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
$args{"output_file"}
do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
Truth table0%0/3
A // B
A= $args{"output_file"}B= do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
| |||||||||||||||||||||
| 84 | 0 | (my $val = "lib/$output_module.pm") =~ s!::!/!g; | |||||||||||||||||||
| 85 | 0 | $val; | |||||||||||||||||||
| 86 | }; | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 0 | my $idx = $args{input_list_index}; | |||||||||||||||||||
| 89 | 0 | (my $input_module_pm = "$input_module.pm") =~ s!::!/!g; | |||||||||||||||||||
| 90 | 0 | require $input_module_pm; | |||||||||||||||||||
| 91 | 0 | my $module_lists = \@{"$input_module\::Module_Lists"}; | |||||||||||||||||||
| 92 | 0 | ▶ | @$module_lists or return [412, "$input_module doesn't contain any module list"]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 93 | 0 | ▶ | if (@$module_lists > 1) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 94 | 0 | ▶ | defined $idx or return [400, "Please specify input_list_index because $input_module contains more than one module list"]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 95 | 0 | ▶ | $idx < @$module_lists or return [400, "There is no module list #$idx in $input_module"]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 96 | } | ||||||||||||||||||||
| 97 | 0 | ▶ | $idx //= 0; | ||||||||||||||||||
|
Condition0%0/2
$idx //= 0
MC/DC0%0/1
$idx //= 0
$idx
Truth table0%0/2
A
A= $idx
| |||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | 0 | ▶ | if (-f $output_file) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 100 | 0 | ▶ | $args{overwrite} or return [412, "Output file $output_file already exists, specify another file or --overwrite"]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 101 | } else { | ||||||||||||||||||||
| 102 | 0 | ▶ | if ($output_file =~ m!/.!) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 103 | 0 | (my $dir = $output_file) =~ s!(.+)/.+!$1!; | |||||||||||||||||||
| 104 | 0 | File::Path::make_path($dir); | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 0 | (my $prog = $0) =~ s!.+/!!; | |||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | my $output = join( | ||||||||||||||||||||
| 111 | "", | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 0 | ▶ | "# This file was first automatically generated by $prog on ", (scalar localtime), " from module list in ", $input_module, " version ", (${"$input_module\::VERSION"} // "dev"), ".\n", | ||||||||||||||||||
|
Condition0%0/2
$module_lists->[$idx]{"summary"} // "(no summary)"
MC/DC0%0/1
$module_lists->[$idx]{"summary"} // "(no summary)"
$module_lists->[$idx]{"summary"}
Truth table0%0/2
A
A= $module_lists->[$idx]{"summary"}
| |||||||||||||||||||||
| 114 | "\n", | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | "package $output_module;\n", | ||||||||||||||||||||
| 117 | "\n", | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | "use strict;\n\n", | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | "# AUTHORITY\n", | ||||||||||||||||||||
| 122 | "# DATE\n", | ||||||||||||||||||||
| 123 | "# DIST\n", | ||||||||||||||||||||
| 124 | "# VERSION\n", | ||||||||||||||||||||
| 125 | "\n", | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | "our \$LIST = ", Data::Dump::dump($module_lists->[$idx]), ";\n", | ||||||||||||||||||||
| 128 | "\n", | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | "1;\n", | ||||||||||||||||||||
| 131 | 0 | ▶ | "# ABSTRACT: ", ($module_lists->[$idx]{summary} // "(no summary)"), "\n", | ||||||||||||||||||
|
Condition0%0/2
${"${input_module}::VERSION";} // "dev"
MC/DC0%0/1
${"${input_module}::VERSION";} // "dev"
${"${input_module}::VERSION";}
Truth table0%0/2
A
A= ${"${input_module}::VERSION";}
| |||||||||||||||||||||
| 132 | "\n", | ||||||||||||||||||||
| 133 | ); | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | 0 | log_info "Writing output to $output_file ..."; | |||||||||||||||||||
| 136 | 0 | File::Slurper::write_text($output_file, $output); | |||||||||||||||||||
| 137 | 0 | [200]; | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | $SPEC{gen_acme_cpanmodules_module_from_webpage} = { | ||||||||||||||||||||
| 141 | 1 | v => 1.1, | |||||||||||||||||||
| 142 | summary => 'Generate an Acme::CPANModules module file a webpage', | ||||||||||||||||||||
| 143 | description => <<'_', | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | This routine will download the webpage, extract the links in it, extract the | ||||||||||||||||||||
| 146 | CPAN modules mentioned in the links, and use the extracted CPAN modules as | ||||||||||||||||||||
| 147 | entries for the Acme::CPANModules module. | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | _ | ||||||||||||||||||||
| 150 | args => { | ||||||||||||||||||||
| 151 | url => { | ||||||||||||||||||||
| 152 | schema => 'str*', # XXX url | ||||||||||||||||||||
| 153 | req => 1, | ||||||||||||||||||||
| 154 | pos => 0, | ||||||||||||||||||||
| 155 | }, | ||||||||||||||||||||
| 156 | output_module => { | ||||||||||||||||||||
| 157 | schema => 'perl::modname*', | ||||||||||||||||||||
| 158 | req => 1, | ||||||||||||||||||||
| 159 | pos => 1, | ||||||||||||||||||||
| 160 | description => <<'_', | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | "Acme::CPANModules::" will be prepended if module name does not begin with it. | ||||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | _ | ||||||||||||||||||||
| 165 | }, | ||||||||||||||||||||
| 166 | output_file => { | ||||||||||||||||||||
| 167 | schema => 'filename*', | ||||||||||||||||||||
| 168 | pos => 2, | ||||||||||||||||||||
| 169 | description => <<'_', | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | will default to "lib/Acme/CPANModules/<YourModuleName>.pm | ||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | _ | ||||||||||||||||||||
| 174 | #cmdline_aliases => {o=>{}}, | ||||||||||||||||||||
| 175 | }, | ||||||||||||||||||||
| 176 | overwrite => { | ||||||||||||||||||||
| 177 | schema => 'true*', | ||||||||||||||||||||
| 178 | cmdline_aliases => {O=>{}}, | ||||||||||||||||||||
| 179 | }, | ||||||||||||||||||||
| 180 | description => { | ||||||||||||||||||||
| 181 | summary => 'Add description to the list', | ||||||||||||||||||||
| 182 | schema => 'str*', | ||||||||||||||||||||
| 183 | }, | ||||||||||||||||||||
| 184 | }, | ||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||
| 186 | 0 | ▶ | sub gen_acme_cpanmodules_module_from_webpage { | ||||||||||||||||||
|
Subroutine
gen_acme_cpanmodules_module_from_webpage: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||
| 187 | 0 | require CPAN::Module::FromURL; | |||||||||||||||||||
| 188 | 0 | require Data::Dump; | |||||||||||||||||||
| 189 | 0 | require File::Path; | |||||||||||||||||||
| 190 | 0 | require File::Slurper; | |||||||||||||||||||
| 191 | 0 | require HTTP::Tiny; | |||||||||||||||||||
| 192 | 0 | require HTML::LinkExtor; | |||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | 0 | my %args = @_; | |||||||||||||||||||
| 195 | 0 | my $url = $args{url}; | |||||||||||||||||||
| 196 | 0 | my $output_module = $args{output_module}; | |||||||||||||||||||
| 197 | 0 | ▶ | $output_module = "Acme::CPANModules::$output_module" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 198 | unless $output_module =~ /\AAcme::CPANModules::/; | ||||||||||||||||||||
| 199 | #log_trace "output_module=$output_module"; | ||||||||||||||||||||
| 200 | 0 | ▶ | my $output_file = $args{output_file} // do { | ||||||||||||||||||
|
Condition0%0/3
$args{"output_file"} // do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
MC/DC0%0/2
$args{"output_file"} // do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
$args{"output_file"}
do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
Truth table0%0/3
A // B
A= $args{"output_file"}B= do {
(my $val = "lib/$output_module.pm") =~ s[::][/]g;
$val
}
| |||||||||||||||||||||
| 201 | 0 | (my $val = "lib/$output_module.pm") =~ s!::!/!g; | |||||||||||||||||||
| 202 | 0 | $val; | |||||||||||||||||||
| 203 | }; | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | 0 | ▶ | if (-f $output_file) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 206 | 0 | ▶ | $args{overwrite} or return [412, "Output file $output_file already exists, specify another file or --overwrite"]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 207 | } else { | ||||||||||||||||||||
| 208 | 0 | ▶ | if ($output_file =~ m!/.!) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 209 | 0 | (my $dir = $output_file) =~ s!(.+)/.+!$1!; | |||||||||||||||||||
| 210 | 0 | File::Path::make_path($dir); | |||||||||||||||||||
| 211 | } | ||||||||||||||||||||
| 212 | } | ||||||||||||||||||||
| 213 | |||||||||||||||||||||
| 214 | my $list = { | ||||||||||||||||||||
| 215 | 0 | ▶ | summary => $args{summary} // "List of modules mentioned in $url", | ||||||||||||||||||
|
Condition0%0/2
$args{"summary"} // "List of modules mentioned in $url"
MC/DC0%0/1
$args{"summary"} // "List of modules mentioned in $url"
$args{"summary"}
Truth table0%0/2
A
A= $args{"summary"}
| |||||||||||||||||||||
| 216 | entries => [], | ||||||||||||||||||||
| 217 | }; | ||||||||||||||||||||
| 218 | |||||||||||||||||||||
| 219 | 0 | ▶ | $list->{description} = $args{description} if $args{description}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | 0 | my $res = HTTP::Tiny->new->get($url); | |||||||||||||||||||
| 222 | 0 | ▶ | return [500, "Couldn't retrieve URL $url: $res->{status} - $res->{reason}"] unless $res->{success}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | 0 | my $p = HTML::LinkExtor->new; | |||||||||||||||||||
| 225 | 0 | $p->parse($res->{content}); | |||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | 0 | my %link_urls; | |||||||||||||||||||
| 228 | 0 | for my $link ($p->links) { | |||||||||||||||||||
| 229 | 0 | my $tag = shift @$link; | |||||||||||||||||||
| 230 | 0 | ▶ | next unless $tag eq 'a'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 231 | 0 | my %attrs = @$link; | |||||||||||||||||||
| 232 | #use DD; dd \%attrs; | ||||||||||||||||||||
| 233 | 0 | my $link_url = $attrs{href}; | |||||||||||||||||||
| 234 | 0 | ▶ | next if $link_urls{$link_url}++; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 235 | 0 | my $mod = CPAN::Module::FromURL::extract_cpan_module_from_url($link_url); | |||||||||||||||||||
| 236 | 0 | ▶ | next unless defined $mod; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 237 | 0 | push @{ $list->{entries} }, {module=>$mod}; | |||||||||||||||||||
| 238 | } | ||||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | 0 | (my $prog = $0) =~ s!.+/!!; | |||||||||||||||||||
| 241 | |||||||||||||||||||||
| 242 | 0 | my $output = join( | |||||||||||||||||||
| 243 | "", | ||||||||||||||||||||
| 244 | |||||||||||||||||||||
| 245 | "# This file was first automatically generated by $prog on ", (scalar localtime), " from webpage at $url.\n", | ||||||||||||||||||||
| 246 | "\n", | ||||||||||||||||||||
| 247 | |||||||||||||||||||||
| 248 | "package $output_module;\n", | ||||||||||||||||||||
| 249 | "\n", | ||||||||||||||||||||
| 250 | |||||||||||||||||||||
| 251 | "use strict;\n\n", | ||||||||||||||||||||
| 252 | |||||||||||||||||||||
| 253 | "# AUTHORITY\n", | ||||||||||||||||||||
| 254 | "# DATE\n", | ||||||||||||||||||||
| 255 | "# DIST\n", | ||||||||||||||||||||
| 256 | "# VERSION\n", | ||||||||||||||||||||
| 257 | "\n", | ||||||||||||||||||||
| 258 | |||||||||||||||||||||
| 259 | "our \$LIST = ", Data::Dump::dump($list), ";\n", | ||||||||||||||||||||
| 260 | "\n", | ||||||||||||||||||||
| 261 | |||||||||||||||||||||
| 262 | "1;\n", | ||||||||||||||||||||
| 263 | "# ABSTRACT:\n", | ||||||||||||||||||||
| 264 | "\n", | ||||||||||||||||||||
| 265 | |||||||||||||||||||||
| 266 | "=head1 DESCRIPTION\n\n", | ||||||||||||||||||||
| 267 | "This L<Acme::CPANModules> module was first automatically generated from list of modules mentioned at L<$url>.\n\n", | ||||||||||||||||||||
| 268 | |||||||||||||||||||||
| 269 | "=cut\n\n", | ||||||||||||||||||||
| 270 | ); | ||||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | 0 | log_info "Writing output to $output_file ..."; | |||||||||||||||||||
| 273 | 0 | File::Slurper::write_text($output_file, $output); | |||||||||||||||||||
| 274 | 0 | [200]; | |||||||||||||||||||
| 275 | } | ||||||||||||||||||||
| 276 | |||||||||||||||||||||
| 277 | $SPEC{acme_cpanmodules_for} = { | ||||||||||||||||||||
| 278 | 1 | v => 1.1, | |||||||||||||||||||
| 279 | summary => 'List Acme::CPANModules distributions that mention specified modules', | ||||||||||||||||||||
| 280 | description => <<'_', | ||||||||||||||||||||
| 281 | |||||||||||||||||||||
| 282 | This utility consults <prog:lcpan> (local indexed CPAN mirror) to check if there | ||||||||||||||||||||
| 283 | are <pm:Acme::CPANModules> distributions that mention specified modules. This is | ||||||||||||||||||||
| 284 | done by checking the presence of a dependency with the relationship | ||||||||||||||||||||
| 285 | `x_mentions`. | ||||||||||||||||||||
| 286 | |||||||||||||||||||||
| 287 | See also <pm:App::lcpan> which has a "x-mentions-for-mod" subcommand that does | ||||||||||||||||||||
| 288 | the same thing. | ||||||||||||||||||||
| 289 | |||||||||||||||||||||
| 290 | _ | ||||||||||||||||||||
| 291 | args => { | ||||||||||||||||||||
| 292 | modules => { | ||||||||||||||||||||
| 293 | schema => ['array*', of=>'perl::modname*'], | ||||||||||||||||||||
| 294 | req => 1, | ||||||||||||||||||||
| 295 | pos => 0, | ||||||||||||||||||||
| 296 | greedy => 1, | ||||||||||||||||||||
| 297 | }, | ||||||||||||||||||||
| 298 | }, | ||||||||||||||||||||
| 299 | links => [ | ||||||||||||||||||||
| 300 | # clashes with SEE ALSO in this POD | ||||||||||||||||||||
| 301 | #{url=>'pm:App::lcpan', summary=>'lcpan also has a "x-mentions-for-mod" subcommand that does the same thing'}, | ||||||||||||||||||||
| 302 | ], | ||||||||||||||||||||
| 303 | }; | ||||||||||||||||||||
| 304 | 0 | ▶ | sub acme_cpanmodules_for { | ||||||||||||||||||
|
Subroutine
acme_cpanmodules_for: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 305 | 0 | require App::lcpan::Call; | |||||||||||||||||||
| 306 | |||||||||||||||||||||
| 307 | 0 | my %args = @_; | |||||||||||||||||||
| 308 | |||||||||||||||||||||
| 309 | my $res = App::lcpan::Call::call_lcpan_script( | ||||||||||||||||||||
| 310 | 0 | argv => ["rdeps", "--rel", "x_mentions", @{ $args{modules} }], | |||||||||||||||||||
| 311 | ); | ||||||||||||||||||||
| 312 | |||||||||||||||||||||
| 313 | 0 | ▶ | return $res unless $res->[0] == 200; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 314 | |||||||||||||||||||||
| 315 | 0 | return [200, "OK", [grep {/\AAcme-CPANModules/} | |||||||||||||||||||
| 316 | 0 | map {$_->{dist}} @{ $res->[2] }]]; | |||||||||||||||||||
| 317 | } | ||||||||||||||||||||
| 318 | |||||||||||||||||||||
| 319 | 1 | 1; | |||||||||||||||||||
| 320 | # ABSTRACT: Command-line utilities related to Acme::CPANModules | ||||||||||||||||||||
| 321 | |||||||||||||||||||||
| 322 | __END__ | ||||||||||||||||||||