| 1 | package App::lcpan::Cmd::mod_contents; | ||||||||||
| 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 | require App::lcpan::Cmd::contents; | |||||||||
| 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 | my %cmd_args = ( | ||||||||||
| 18 | 1 | %{ $App::lcpan::Cmd::contents::SPEC{handle_cmd}{args} }, | |||||||||
| 19 | %App::lcpan::mod_args, | ||||||||||
| 20 | ); | ||||||||||
| 21 | 1 | delete $cmd_args{query}; | |||||||||
| 22 | 1 | delete $cmd_args{query_type}; | |||||||||
| 23 | 1 | delete $cmd_args{dist}; | |||||||||
| 24 | |||||||||||
| 25 | 1 | $SPEC{'handle_cmd'} = { | |||||||||
| 26 | v => 1.1, | ||||||||||
| 27 | summary => "List contents inside a module's distribution", | ||||||||||
| 28 | description => <<'_', | ||||||||||
| 29 | |||||||||||
| 30 | This subcommand lists files inside a module's distribution. | ||||||||||
| 31 | |||||||||||
| 32 | % lcpan mod-contents Foo::Bar | ||||||||||
| 33 | |||||||||||
| 34 | is basically equivalent to: | ||||||||||
| 35 | |||||||||||
| 36 | % lcpan contents --dist `lcpan mod2dist Foo::Bar` | ||||||||||
| 37 | |||||||||||
| 38 | _ | ||||||||||
| 39 | args => \%cmd_args, | ||||||||||
| 40 | }; | ||||||||||
| 41 | 0 | ▶ | sub handle_cmd { | ||||||||
|
Subroutine
handle_cmd: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 42 | 0 | my %args = @_; | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $state = App::lcpan::_init(\%args, 'ro'); | |||||||||
| 45 | 0 | my $dbh = $state->{dbh}; | |||||||||
| 46 | |||||||||||
| 47 | my ($file_id) = $dbh->selectrow_array( | ||||||||||
| 48 | 0 | "SELECT file_id FROM module WHERE name=?", {}, $args{module}); | |||||||||
| 49 | 0 | ▶ | $file_id or return [404, "No such module '$args{module}'"]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | delete $args{module}; | |||||||||
| 52 | 0 | App::lcpan::Cmd::contents::handle_cmd( | |||||||||
| 53 | %args, | ||||||||||
| 54 | file_id => $file_id, | ||||||||||
| 55 | ); | ||||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 1 | 1; | |||||||||
| 59 | # ABSTRACT: List contents inside a module's distribution | ||||||||||
| 60 | |||||||||||
| 61 | __END__ | ||||||||||