File Coverage

lib/Rex/Cron/FreeBSD.pm
Criterion Covered Total %
statement 17 30 56.6
branch 0 4 0.0
condition 0 3 0.0
subroutine 6 8 75.0
pod 0 2 0.0
total 23 47 48.9


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Cron::FreeBSD;
6              
7 1     1   15 use v5.12.5;
  1         3  
8 1     1   6 use warnings;
  1         2  
  1         52  
9              
10             our $VERSION = '1.14.2.3'; # TRIAL VERSION
11              
12 1     1   12 use Rex::Cron::Base;
  1         4  
  1         13  
13 1     1   34 use base qw(Rex::Cron::Base);
  1         3  
  1         67  
14              
15 1     1   6 use Rex::Helper::Run;
  1         2  
  1         53  
16 1     1   7 use Rex::Helper::Path;
  1         3  
  1         214  
17              
18             sub new {
19 0     0 0   my $that = shift;
20 0   0       my $proto = ref($that) || $that;
21 0           my $self = $proto->SUPER::new(@_);
22              
23 0           bless( $self, $proto );
24              
25 0           return $self;
26             }
27              
28             sub read_user_cron {
29 0     0 0   my ( $self, $user ) = @_;
30 0 0         $user = undef if $user eq $self->_whoami;
31              
32 0           my $tmp_file = get_tmp_file;
33              
34 0           my $command = '( crontab -l';
35 0 0         $command .= " -u $user" if defined $user;
36 0           $command .= " >$tmp_file ) >& /dev/null ; cat $tmp_file ; rm $tmp_file";
37              
38 0           my @lines = i_run $command;
39 0           $self->parse_cron(@lines);
40             }
41              
42             1;