lib/WWW/Hetzner/CLI/Cmd/PlacementGroup/Cmd/Describe.pm

filter: Statementstmt 90.0% 27 / 30 Branchbran 50.0% 3 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 74.0% 37 / 50 CC 6 SCAR 15.7
CC
6
Cov
78%
execute
7.3
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Folders.pm »
1 package WWW::Hetzner::CLI::Cmd::PlacementGroup::Cmd::Describe;
2 # ABSTRACT: Describe a placement group
3  
4 1 our $VERSION = '0.102';
5  
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooX::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooX::Options protect_argv => 0, usage_string => 'USAGE: hcloud.pl placement-group describe <id>';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use JSON::MaybeXS qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶sub execute {
Subroutine execute: called CC=6 SCAR=19.9
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 ▶ my $id = $args->[0] or die "Usage: hcloud.pl placement-group describe <id>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl placement-group describe <id>\n" 1 0 1
14  
15 1 my $main = $chain->[0];
16 1 my $cloud = $main->cloud;
17  
18 1 my $pg = $cloud->placement_groups->get($id);
19  
20 1 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 0 1 1
21 0 print encode_json($pg->data), "\n";
22 0 return;
23 }
24  
25 1 printf "ID: %s\n", $pg->id;
26 1 printf "Name: %s\n", $pg->name;
27 1 printf "Type: %s\n", $pg->type;
28 1 ▶ printf "Created: %s\n", $pg->created // '-';
Condition50%1/2
$pg->created // "-"
l!l
10
MC/DC0%0/1
$pg->created // "-"
$pg->created
Truth table50%1/2
A
A= $pg->created
Aresult
11
00
29  
30 1 my $servers = $pg->servers;
31 1 ▶ if ($servers && @$servers) {
Branch: 1 branch
BranchTrueFalseTotal
if ($servers and @$servers) { } 1 0 1
Condition33%1/3
$servers and @$servers
!ll&&!rl&&r
001
MC/DC0%0/2
$servers and @$servers
$servers @$servers
Truth table33%1/3
A and B
A= $serversB= @$servers
ABresult
0X0
100
111
32 1 printf "Servers: %s\n", join(', ', @$servers);
33 } else {
34 0 print "Servers: none\n";
35 }
36 }
37  
38 1 1;
39  
40 __END__
« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Folders.pm »