lib/Rex/Cron/FreeBSD.pm

filter: Statementstmt 59.3% 19 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 49.0% 25 / 51 CC 4 SCAR 15.9
CC
4
Cov
49%
read_user_cron
12.0
new
6.0
BEGIN
1.0
CRAP 4.9
« lib/Rex/Interface/Fs/Base.pm ↑ Summary lib/Rex/Cron/Base.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Cron::FreeBSD;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex::Cron::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use base qw(Rex::Cron::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Rex::Helper::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $that = shift;
20 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
21 0 my $self = $proto->SUPER::new(@_);
22  
23 0 bless( $self, $proto );
24  
25 0 return $self;
26 }
27  
28 0 ▶sub read_user_cron {
Subroutine read_user_cron: not called CC=3 SCAR=24.8
Pod undocumented
29 0 my ( $self, $user ) = @_;
30 0 ▶ $user = undef if $user eq $self->_whoami;
Branch: 1 branch
BranchTrueFalseTotal
if $user eq $self->_whoami 0 0 0
31  
32 0 my $tmp_file = get_tmp_file;
33  
34 0 my $command = '( crontab -l';
35 0 ▶ $command .= " -u $user" if defined $user;
Branch: 1 branch
BranchTrueFalseTotal
if defined $user 0 0 0
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 1;
« lib/Rex/Interface/Fs/Base.pm ↑ Summary lib/Rex/Cron/Base.pm »