lib/WWW/Hetzner/Robot/CLI/Cmd/Wol.pm

filter: Statementstmt 85.7% 18 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 80.0% 24 / 30 CC 3 SCAR 7.9
CC
3
Cov
80%
execute
3.4
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« lib/WWW/Hetzner/Cloud/API/Zones.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Reset.pm »
1 package WWW::Hetzner::Robot::CLI::Cmd::Wol;
2 # ABSTRACT: Send Wake-on-LAN to a server
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: hrobot.pl wol <server-number>';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 1 ▶sub execute {
Subroutine execute: called CC=3 SCAR=12.3
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 my $root = $chain->[0];
14 1 my $robot = $root->robot;
15  
16 1 ▶ my $server_number = $args->[0] or die "Usage: hrobot.pl wol <server-number>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $server_number = $args->[0] or die "Usage: hrobot.pl wol <server-number>\n" 1 0 1
17  
18 1 my $result = $robot->reset->wol($server_number);
19  
20 1 ▶ if ($root->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($root->output eq 'json') { } 0 1 1
21 0 require JSON::MaybeXS;
22 0 print JSON::MaybeXS::encode_json($result);
23 0 print "\n";
24 } else {
25 1 print "Wake-on-LAN sent to server $server_number\n";
26 }
27 }
28  
29 1 1;
30  
31 __END__
« lib/WWW/Hetzner/Cloud/API/Zones.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Reset.pm »