in reply to Re: time validation
in thread time validation

Shame that there's a bug in the module :-(

So, to work around that bug, you could parse the time as above, then format it back into a string in the original format, and do a string comparison. If it's completely valid, then the round trip will get you back to exactly where you started.

Also, if you want to avoid your code dying if the date's not valid, then just remove that option from the creation of the object - the default behaviour is to return undef if it's not parsable, which is almost certainly more useful in this case.

--
use JAPH;
print JAPH::asString();

Replies are listed 'Best First'.
Re^3: time validation
by Anonymous Monk on May 19, 2009 at 11:35 UTC
    then format it back into a string in the original format, and do a string comparison.

    Or fix the bug ;) Or since the format is all numbers , easy to screen /\A\d+\z/.

      Don't forget that the string could be the wrong length, so m/^\d{14}$/

      Or fix the bug :-)

      --
      use JAPH;
      print JAPH::asString();