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

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 CC 2 SCAR 12.0
CC
2
Cov
0%
execute
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package WWW::Hetzner::Robot::CLI::Cmd::Wol;
2 # ABSTRACT: Send Wake-on-LAN to a server
3  
4 our $VERSION = '0.100';
5  
6 use Moo;
7 use MooX::Cmd;
8 use MooX::Options protect_argv => 0, usage_string => 'USAGE: hrobot.pl wol <server-number>';
9  
10  
11 sub execute {
12 my ($self, $args, $chain) = @_;
13 my $root = $chain->[0];
14 my $robot = $root->robot;
15  
16 my $server_number = $args->[0] or die "Usage: hrobot.pl wol <server-number>\n";
17  
18 my $result = $robot->reset->wol($server_number);
19  
20 if ($root->output eq 'json') {
21 require JSON::MaybeXS;
22 print JSON::MaybeXS::encode_json($result);
23 print "\n";
24 } else {
25 print "Wake-on-LAN sent to server $server_number\n";
26 }
27 }
28  
29 1;
30  
31 __END__