pcouderc has asked for the wisdom of the Perl Monks concerning the following question:

I get surprising results with :

#!/usr/bin/perl # # # Problem with Date::Manip # use strict; use warnings; use Date::Manip; my $Date; sub printit{ my $Datea = &ParseDate($Date); my $Dateb = " english dates Ok"; if(!$Datea){ &Date_Init("Language=French"); $Dateb = &ParseDate($Date); &Date_Init("Language=English"); $Datea = "Try french?"; if(!$Dateb) { $Dateb = "French fails too!";} } print "== $Datea $Dateb\n"; } $Date = 'Tue Sep 27 12:46:10 CEST 2005'; printit(); $Date = 'lun oct 17 15:59:40 CEST 2005'; printit(); $Date = 'mer sep 28 09:41:54 CEST 2005'; printit();

And I get :

== 2005092712:46:10 english dates Ok == Try french? 2005101715:59:40 == Try french? French fails too!

The question is : What Date::Manip has against the month of September? Or more probably : What am I missing?
Thank you in advance, kind monks
Pierre couderc

Edit: g0n - changed pre tags to code tags

Replies are listed 'Best First'.
Re: Strange behaviour of Date::Manip
by japhy (Canon) on Oct 17, 2005 at 16:50 UTC
    Date::Manip expects 'sept' as the abbreviation for septembre.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
      Ok, but in this case this is nearly a bug... as it is accepted for english : i want Date::Manip (great thanks to Sullivan Beck) to do not care with these kind of things...
Re: Strange behaviour of Date::Manip
by Zed_Lopez (Chaplain) on Oct 17, 2005 at 19:18 UTC

    Date::Manip is designed to handle multiple values for month abbreviations -- if you ask the maintainer, s/he might well be willing to modify it to include "sep" for French.

    In the meantime, it would be easy to modify a local copy .

    sub Date_Init_French { # [...] $$d{"month_abb"}= [["jan","fev","mar","avr","mai","juin", "juil","aout","sept","oct","nov","dec"], ["jan","f${e}v","mar","avr","mai","juin", "juil","ao${u}t","sept","oct","nov","d${e}c"], ["jan","fev","mar","avr","mai","juin", "juil","aout","sep","oct","nov","dec"]];
      Yes I think that it is the good solution. I contact Sullivan Beck.
      Thank you all.
      Pierre Couderc
Re: Strange behaviour of Date::Manip
by pcouderc (Monk) on Oct 17, 2005 at 18:31 UTC
    Please note that these dates were extracted from a commitlog.txt generated by our cvs (which mixes dates in many languages).