in reply to Timelocal out of range message
G'day itis.guptak,
Welcome to the monastery.
Please provide a short script that reproduces your problem. How to do this is explained in "How do I post a question effectively?".
Without seeing any code or data, we are not able to "find the reason for this error". However, the only instance I can think of giving "Day '29' out of range 1..28" would be during February of a non-leap year.
Please ensure you haven't made a simple syntax error (e.g. number and order of timelocal() arguments) by checking the Time::Local documentation.
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timelocal out of range message
by itis.guptak (Initiate) on Feb 03, 2014 at 07:36 UTC | |
Thanks, Ken. Let me just explain what this script does. It pulls the systems message file from a list of hosts and put the content in a single file output on a central server from where it's run as cron job. I'm pasting a portion of code that's responsible for timelocal() execution in the script. The code I'm pasting contains three subroutines: addMessage(), processFile(), getLogsSCP(). getLogsSCP() will scp the files to central server. processFile() is called within getLogsSCP() and processFile() furthur calls addMessage(). Finally it's the addMessage() that invokes timelocal(). I've also pasted some variables used for computing the parameters passed to the timelocal function. This line of the code is generating the error.
Code
| [reply] [d/l] [select] |
by kcott (Archbishop) on Feb 04, 2014 at 04:19 UTC | |
I wrote: "Please provide a short script that reproduces your problem. How to do this is explained in "How do I post a question effectively?"." Had you followed that link, you would have seen, in big, friendly letters, at the top of the screen: Paste actual code that reproduces the problem ... You haven't posted actual code. You haven't posted code that reproduces your problem. In addition, hundreds of lines of code is not a "short script": a dozen or so lines normally suffices for this sort of task. If you ever do need to post large tracts of code, data, etc., wrap it in <spoiler>...</spoiler> or <readmore>...</readmore> tags: see "Markup in the Monastery" and "Writeup Formatting Tips". What you have posted appears to have been copied from your browser. It looks like the code you posted a couple of hours before in this thread; it includes all the '+' signs at the beginning of lines (that indicate that a line wrapped) which are not part of the Perl code. If you can post a short script that shows Time::Local::timelocal() giving your "Timelocal out of range message", I'll be happy to look at it further. In writing a short script to reproduce your problem, you'll often gain insights into why your original code was having issues. Something else you can do is to add print statements to your original code to see what actual values are being passed to your functions. This can often point to where the problem lies. -- Ken | [reply] [d/l] [select] |