lib/Rex/Cron.pm

filter: Statementstmt 50.0% 13 / 26 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 1 totaltotal 38.6% 17 / 44 CC 5 SCAR 27.5
CC
5
Cov
37%
create
30.0
__ANON__
2.0
BEGIN
1.0
CRAP 15.6
« lib/Rex/Box.pm ↑ Summary lib/Rex/Interface/Cache/YAML.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Cron;
6  
7 32 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 32 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 32 our $VERSION = '1.16.1'; # VERSION
11  
12 32 ▶use Rex::Commands::Gather;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 32 ▶use List::Util qw'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub create {
Subroutine create: not called CC=5 SCAR=34.0
Pod undocumented
16 0 my ($class) = @_;
17  
18 0 my $type = "Linux";
19 0 ▶ if ( operating_system_is("SunOS") ) {
Branch: 1 branch
BranchTrueFalseTotal
if (operating_system_is("SunOS")) 0 0 0
20 0 $type = "SunOS";
21 }
22  
23 0 my $exec = Rex::Interface::Exec->create;
24  
25 # here we're using first and not any, because in older perl versions
26 # there is no any() function in List::Util.
27 0 ▶ if ( operating_system_is( "FreeBSD", "OpenBSD", "NetBSD" )
Branch: 1 branch
BranchTrueFalseTotal
if (operating_system_is("FreeBSD", "OpenBSD", "NetBSD") and &first(sub { $exec->shell->name eq $_; } , "csh", "ksh", "tcsh")) 0 0 0
Condition0%0/3
operating_system_is("FreeBSD", "OpenBSD", "NetBSD") and &first(sub { $exec->shell->name eq $_; } , "csh", "ksh", "tcsh")
!ll&&!rl&&r
000
MC/DC0%0/2
operating_system_is("FreeBSD", "OpenBSD", "NetBSD") and &first(sub { $exec->shell->name eq $_; } , "csh", "ksh", "tcsh")
operating_system_is("FreeBSD", "OpenBSD", "NetBSD") &first(sub { $exec->shell->name eq $_; } , "csh", "ksh", "tcsh")
Truth table0%0/3
A and B
A= operating_system_is("FreeBSD", "OpenBSD", "NetBSD")B= &first(sub { $exec->shell->name eq $_; } , "csh", "ksh", "tcsh")
ABresult
0X0
100
111
28 0 ▶ && first { $exec->shell->name eq $_ } (qw/csh ksh tcsh/) )
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 {
30 0 $type = "FreeBSD";
31 }
32  
33 0 my $klass = "Rex::Cron::$type";
34 0 eval "use $klass;";
35 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
36 0 die("Error creating cron class: $klass\n$@");
37 }
38  
39 0 return $klass->new;
40 }
41  
42 32 1;
« lib/Rex/Box.pm ↑ Summary lib/Rex/Interface/Cache/YAML.pm »