Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 124523
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: bitcardbmw [...] lsmod.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.2.9
Fixed in: 3.40



Subject: examples/populate_mailbox.pl should use 4-digit dates
man Time::Local says Show quoted text
> Whenever possible, use an absolute four digit year instead.
With a detailed explanation about ambiguity of 2-digit dates above that. Please apply this fix: +++ Mail-IMAPClient-3.37/examples/populate_mailbox.pl @@ -107 +107 @@ sub seconds { - return timegm(0,$min,$hr,$dom,$moy-1,($yy>99?$yy-1900:$yy)) ; + return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy+1900)) ; 99?$yy:$yy+1900)) ;
This is old example code. However looking at things in context, we find that the regex matches a four-digit year via \d\d\d\d. Thus, I'd expect the desired behavior is to represent that year, be it 99, 999 or 1999 as the actual year matched. As such, I believe the proper "fix" would be to work around the attempts of Time::Local attempting to "do the right thing" by doing this: # allow year 0999 to be year 999, and year 0099 to be year 99 return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy-1900));
Change I mentioned, will be in the next release along with this example code being run through perltidy and other format cleanups.
Subject: Re: [rt.cpan.org #124523] examples/populate_mailbox.pl should use 4-digit dates
Date: Mon, 12 Mar 2018 15:14:55 +0100
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: "Bernhard M. Wiedemann" <bernhardout [...] lsmod.de>
On 2018-03-12 14:55, Phil Pearl (Lobbes) via RT wrote: Show quoted text
> > # allow year 0999 to be year 999, and year 0099 to be year 99 > return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy-1900));
that could work, too. Though I expect that timegm was never intended to work with years < 1000 when the gregorian calendar was not yet invented. But luckily no emails exist from that time (until some genius imports historic letters from libraries into IMAP ;-)
Release 3.40 is out with the fix for this issue.