I have a cgi script that processes a bunch of files that have a date in them
that should be formatted like so:
date=11/01/2003
I want to trap bad data sent to time::local in a loop where I use these lines:
my ($date_month, $date_day, $date_year) = split(/\//,
$DOCUMENT->param("date"));
$date_year = ($date_year-1900);
$date_month = ($date_month-1);
my $test_date = timelocal($sec, $min, $hours, $date_day, $date_month,
$date_year);
Right now my app errors out at the above line if "$test_date" contains bad data
:
Month '-1' out of range 0..11 at /Test.pm line 998.
How can I evaluate the call to timelocal so I can decide what to do if a date
is bad or missing?
Thanks for any help with this...
Bill Stephenson
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/