| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
operating_system_is("FreeBSD", "OpenBSD", "NetBSD") and &first(sub {
$exec->shell->name eq $_;
}
, "csh", "ksh", "tcsh")
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")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 36 | 0 | die("Error creating cron class: $klass\n$@"); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | return $klass->new; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 32 | 1; | |||||||||||||||||||||||||||