Subject: | Support cron entries like */<step> |
Schedule::Cron won't parse cron entries that are in the form of */<step> (e.g. */2). The POD inidicates this should be supported.
I've attached a patch - not the most elegant but seems to work.
# $Id: Cron.pm,v 1.5 2000/07/05 08:02:26 roland Exp $
This is perl, version 5.005_03 built for i386-freebsd
FreeBSD starbug.ugh.net.au 4.10-STABLE FreeBSD 4.10-STABLE #11: Sat Dec 4 02:39:31 EST 2004 andrew@starbug.ugh.net.au:/usr/obj/usr/src/sys/STARBUG i386
--- Cron.pm.orig Thu Dec 30 01:20:59 2004
+++ Cron.pm Thu Dec 30 04:43:23 2004
@@ -598,8 +598,34 @@
my @res;
my $t;
while (defined($t = shift @e)) {
- if ($t =~ m|^([^-]+)-([^-/]+)(/(.*))?$|) {
- my ($low,$high,$step) = ($1,$2,$4);
+ if ($t =~ m@^(?:
+ (\*) # *
+ / # /
+ (.*) # step
+ )
+ | # or
+ (?:
+ ([^-]+) # low
+ - # to
+ ([^-/]+) # high
+ (?:
+ / # /
+ (.*) # step
+ )? # (optional)
+ )
+ $@x) {
+ my ($low,$high,$step);
+ if (defined($1)) {
+ # entry is in */step format
+ $low = $RANGES[$i][0];
+ $high = $RANGES[$i][1];
+ $step = $2;
+ } else {
+ # entry is in low-high/step format
+ $low = $3;
+ $high = $4;
+ $step = $5;
+ }
$step = 1 unless $step;
if ($low !~ /^(\d+)/) {
$low = $ALPHACONV[$i]{lc $low};