Skip Menu |

This queue is for tickets about the Schedule-Cron CPAN distribution.

Report information
The Basics
Id: 9338
Status: resolved
Priority: 0/
Queue: Schedule-Cron

People
Owner: Nobody in particular
Requestors: andrew [...] ugh.net.au
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



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};
Hello Andrew, [guest - Sun Jan 2 16:44:48 2005]: Show quoted text
> 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.
Thanks for submitting your patch. As it happened, I just released a new version 0.9 of Schedule::Cron which already fixed this bug. I just have uploaded it to CPAN. ciao...