| 1 | package App::lcpan::Cmd::inject; | ||||||||||
| 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 Proc::ChildError qw(explain_child_error); | ||||||||
|
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 | 1 | $SPEC{'handle_cmd'} = { | |||||||||
| 18 | v => 1.1, | ||||||||||
| 19 | summary => 'Inject one or more tarballs to the mirror', | ||||||||||
| 20 | args => { | ||||||||||
| 21 | %App::lcpan::common_args, | ||||||||||
| 22 | author => { | ||||||||||
| 23 | schema => ['str*'], | ||||||||||
| 24 | req => 1, | ||||||||||
| 25 | cmdline_aliases => {a=>{}}, | ||||||||||
| 26 | completion => \&_complete_cpanid, | ||||||||||
| 27 | }, | ||||||||||
| 28 | files => { | ||||||||||
| 29 | schema => ['array*', of=>'filename*', min_len=>1], | ||||||||||
| 30 | 'x.name.is_plural' => 1, | ||||||||||
| 31 | req => 1, | ||||||||||
| 32 | pos => 0, | ||||||||||
| 33 | slurpy => 1, | ||||||||||
| 34 | }, | ||||||||||
| 35 | }, | ||||||||||
| 36 | deps => { | ||||||||||
| 37 | prog => 'orepan.pl', | ||||||||||
| 38 | }, | ||||||||||
| 39 | }; | ||||||||||
| 40 | 0 | ▶ | sub handle_cmd { | ||||||||
|
Subroutine
handle_cmd: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 41 | 0 | my %args = @_; | |||||||||
| 42 | |||||||||||
| 43 | 0 | my $state = App::lcpan::_init(\%args, 'rw'); | |||||||||
| 44 | 0 | my $author = delete $args{author}; | |||||||||
| 45 | 0 | my $files = delete $args{files}; | |||||||||
| 46 | 0 | my $dbh = $state->{dbh}; | |||||||||
| 47 | |||||||||||
| 48 | 0 | for my $file (@$files) { | |||||||||
| 49 | 0 | system "orepan.pl", "--destination", $state->{cpan}, "--pause", $author, | |||||||||
| 50 | $file; | ||||||||||
| 51 | 0 | ▶ | return [500, "orepan.pl failed: ".explain_child_error()] if $?; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | App::lcpan::update( | ||||||||||
| 55 | 0 | %args, | |||||||||
| 56 | update_files => 0, | ||||||||||
| 57 | update_index => 1, | ||||||||||
| 58 | ); | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | 1; | |||||||||
| 62 | # ABSTRACT: Inject one or more tarballs to the mirror | ||||||||||
| 63 | |||||||||||
| 64 | __END__ | ||||||||||