in reply to Time::Piece strangeness

I have no clue how to make Time::Piece throw the error, but here's a simple way for your code to do so:

if ( $end_date =~ /[A-Z]{3}\sFeb\s(\d+)\s/i && $1 > 28 ) { print "Wha???? Date is Feb $1 !!!\n"; }

NB: generalizing to distinguish between leap years and non-leap years left as an exercise for the reader.

Replies are listed 'Best First'.
Re^2: Time::Piece strangeness
by davidrw (Prior) on Nov 17, 2005 at 19:08 UTC
    This involves manual string parsing, which half-defeats the purpose of relying on the module to do it for you... also, this is not a february-specific "feature" of Time::Piece:
    [davidrw@host ~]$ perl -MTime::Piece -le 'print Time::Piece->strptime( +"31-06-2006", "%d-%m-%Y")' Sat Jul 1 00:00:00 2006