Subject: | Month globs wrongly decremented |
It fails the test (t/01expand.t):
is_deeply( expand( "*/3", "mon" ), [ 0, 3, 6, 9 ], 'expand mon=*/3' );
because it sets the start & end points to correct values and then enters
the conditional which further decrements the month values. The attached
patch brings the setting of end points to within the conditional.
(btw, thanks for providing this code, it solves a lot of problems)
best regards,
Nic Sandfield
Subject: | fix-month-glob.patch |
--- lib/Algorithm/Cron.pm 2012-10-16 12:30:15.000000000 +0100
+++ lib/Algorithm/Cron.pm.new 2012-10-18 11:53:35.000000000 +0100
@@ -163,9 +163,11 @@
$val =~ s{/(\d+)$}{} and $step = $1;
$val =~ m{^(.+)-(.+)$} and ( $val, $end ) = ( $1, $2 );
- $val eq "*" and ( $val, $end ) = ( $MIN{$kind}, $MAX{$kind} );
- if( $kind eq "mon" ) {
+ if( $val eq "*" ) {
+ ( $val, $end ) = ( $MIN{$kind}, $MAX{$kind} );
+ }
+ elsif( $kind eq "mon" ) {
# Users specify 1-12 but we want 0-11
defined and m/^\d+$/ and $_-- for $val, $end;
# Convert symbolics