Client/Command/all_files.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 42 CC 1 SCAR 6.9
CC
1
Cov
0%
usage_desc
2.0
abstract
2.0
description
2.0
CRAP 2.0
1 package CPAN::Mini::Inject::REST::Client::Command::all_files;
2  
3 use 5.010;
4 use strict;
5 use warnings;
6 use base 'CPAN::Mini::Inject::REST::Client::Command';
7  
8  
9 #--Command usage----------------------------------------------------------------
10  
11 sub usage_desc {
12 return "all_files %o";
13 }
14  
15 sub abstract {
16 return "Lists all files added to the mirror";
17 }
18  
19 sub description {
20 return "Lists all files added to the mirror";
21 }
22  
23  
24 #--Command specific options-----------------------------------------------------
25  
26 sub options {
27 my ($class, $app) = @_;
28
29 return undef;
30 }
31  
32  
33 #--Command execute method-------------------------------------------------------
34  
35 sub execute {
36 my ($self, $opt, $args) = @_;
37  
38 my ($code, $result) = $self->api($opt)->get("all_files");
39
40 given ($code) {
41 when (200) {
42 say "Files:";
43 say " $_" foreach @{$result->{files}};
44 }
45 when (204) {
46 die "No files have been added\n"
47 }
48 default {
49 die "Cannot retrieve file info - unknown error!\n";
50 }
51 }
52 }
53  
54  
55 #-------------------------------------------------------------------------------
56  
57 1;