File Coverage

blib/lib/App/RunCron/Reporter/Command.pm
Criterion Covered Total %
statement 18 18 100.0
branch 4 6 66.6
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 27 31 87.1


line stmt bran cond sub pod time code
1             package App::RunCron::Reporter::Command;
2 1     1   8 use strict;
  1         3  
  1         45  
3 1     1   4 use warnings;
  1         2  
  1         40  
4 1     1   7 use JSON::PP;
  1         2  
  1         239  
5              
6             sub new {
7 2     2 0 7 my ($class, $command) = @_;
8 2 100       8 $command = ref $command ? $command : [$command];
9 2         10 bless $command, $class;
10             }
11              
12             sub run {
13 2     2 0 5 my ($self, $runner) = @_;
14              
15 2 50       4038 open my $pipe, '|-', @$self or die $!;
16              
17 2         63 my $d = $runner->report_data;
18 2 50       54 $d->{is_success} = $d->{is_success} ? $JSON::PP::true : $JSON::PP::false;
19 2         17 print $pipe encode_json($d);
20 2         4627 close $pipe;
21             }
22              
23             1;