Skip Menu |

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

Report information
The Basics
Id: 89947
Status: resolved
Priority: 0/
Queue: Algorithm-Cron

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07
Fixed in: 0.08



Subject: Fails since perl v5.17.1-315-ga64f08c
As per subject. That commit http://perl5.git.perl.org/perl.git/commitdiff/a64f08c disabled the usage of strftime which is used by Algorithm::Cron. The now broken code is in https://metacpan.org/source/PEVANS/Algorithm-Cron-0.07/lib/Algorithm/Cron.pm#L147 Taking an undeniably verified Sunday as a base would probably make the code future proof, something like map { lc(strftime "%a %A, %B %d, %Y\n", 0,0,0,3+$_,10,113), "$_\n" } 0 .. 6; Just an idea. Maybe DateTime has something better. Weird, weird, HTH,,, P.S. what's even weirder is that no bugreport appeared so far
On Fri Nov 01 10:00:02 2013, ANDK wrote: Show quoted text
> The now broken code is in > https://metacpan.org/source/PEVANS/Algorithm-Cron- > 0.07/lib/Algorithm/Cron.pm#L147 > > Taking an undeniably verified Sunday as a base would probably make the > code future proof, something like > > map { lc(strftime "%a %A, %B %d, %Y\n", 0,0,0,3+$_,10,113), "$_\n" } 0 > .. 6;
I ended up taking 4th Jan 1970 as the base. First Sunday I could find ;) Technically the %WDAYS hash only really exists to do the wday string parsing step, in a way that is slightly neater than relying on pulling POSIX::strptime. -- Paul Evans
Subject: rt89947.patch
=== modified file 'lib/Algorithm/Cron.pm' --- lib/Algorithm/Cron.pm 2013-04-14 13:21:13 +0000 +++ lib/Algorithm/Cron.pm 2013-11-06 17:42:32 +0000 @@ -143,8 +143,10 @@ my $old_loc = setlocale( LC_TIME ); setlocale( LC_TIME, "C" ); - %MONTHS = map { lc(strftime "%b", 0,0,0,1,$_,70), $_ } 0 .. 11; - %WDAYS = map { lc(strftime "%a", 0,0,0,0,0,0,$_), $_ } 0 .. 6; + %MONTHS = map { lc(strftime "%b", 0,0,0, 1, $_, 70), $_ } 0 .. 11; + + # 0 = Sun. 4th Jan 1970 was a Sunday + %WDAYS = map { lc(strftime "%a", 0,0,0, 4+$_, 0, 70), $_ } 0 .. 6; setlocale( LC_TIME, $old_loc ); }
Released as 0.08 -- Paul Evans