RajNaidu has asked for the wisdom of the Perl Monks concerning the following question:
When I execute theelow code I am getting below exception error.
Line 405 in the program points to
"return timelocal(0, 0, 0, @dmy) / (24 * 60 * 60);"
Am I missing anything in code.
----------------------------------------------------------------------------------------------------------------
Uncaught exception from user code:
Day '0' out of range 1..31 at
/CLO/Tests/CTI/Scripts/drivers/lib/regressionDriver.pm line 405
Time::Local::timegm called at /usr/local/lib/perl5/5.8.0/Time/Local.pm line 120
Time::Local::timelocal(0,0,0,0,0) called at /CLO/Tests/CTI/Scripts/drivers/lib/regressionDriver.pm line 405
---------------------------------------------
I have the following code in my program. use strict; use warnings; use diagnostics; use Time::Local; my @match_list; my $days1 = ""; my $days2 = ""; my $day = ""; if ($failtag eq "CompileErr") { open my $pipe, "-|", "/usr/atria/bin/cleartool", "desc", "$include_pat +h/$srcfile" or die "could not run cleartool: $!"; while (<$pipe>) { next unless /created/; my @rec = split; push @match_list, substr $rec[1], 0, 9; } my $NOW=`date "+%d-%b-%Y`; m +y $t = @match_list; $days1 = epoch_days("$NOW"); $days2 = epoch_days("$t"); $day = $days1 - $days2; if ($day < 15) { $failtag = "TestcaseDiff"; } BEGIN { my %month_num = do { my $n = 0; map(($_, $n++), qw/jan feb mar apr may jun jul aug sep oct nov dec/); }; sub epoch_days { my @dmy = split /-/, shift; $dmy[1] = $month_num{lc $dmy[1]} || 0; return timelocal(0, 0, 0, @dmy) / (24 * 60 * 60); } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Exception Error in perl code
by FloydATC (Deacon) on Jun 21, 2009 at 16:08 UTC | |
by Rajsri (Initiate) on Jun 29, 2009 at 05:12 UTC | |
by Corion (Patriarch) on Jun 29, 2009 at 06:42 UTC | |
Re: Exception Error in perl code
by Anonymous Monk on Jun 21, 2009 at 14:46 UTC | |
Re: Exception error in perl code
by ikegami (Patriarch) on Jun 25, 2009 at 11:23 UTC | |
by jwkrahn (Abbot) on Jun 25, 2009 at 11:37 UTC | |
by ikegami (Patriarch) on Jun 25, 2009 at 11:41 UTC | |
by Rajsri (Initiate) on Jun 29, 2009 at 05:23 UTC | |
by ikegami (Patriarch) on Jun 29, 2009 at 05:44 UTC | |
Re: Exception Error in perl code
by Corion (Patriarch) on Jun 25, 2009 at 12:16 UTC |
Back to
Seekers of Perl Wisdom