"The scripts are pretty big ..."
That makes no sense in response to an implicit suggestion to read:
The SSCCE: Short, Self-Contained, Correct (Compilable) Example.
From your OP:
"Unable to flush stdout: Invalid argument?"
Find out what generates that message and track back from there.
You might also consider modifying that code such that it produces a more useful message.
Something like:
- What argument does it refer to?
- What line did it occur on?
- What other relevant information is available?
"open(LOG, ">>/Logs/Report.log") ..."
Avoid using global package variables: that leads to action-at-a-distance
and bugs that are hard to track down.
Instead, use lexical variables in the smallest scope possible.
Use meaningful names.
Using common, globally scoped, package variables (e.g. FILE, LOG, IN, OUT),
just exacerbates the problem and makes your debugging task all the more difficult.
Read the open documentation,
then rewrite that code more like this:
open my $report_log_fh, '>>', $logfilename ...
Not checking for I/O errors is also a problem.
Either write your own; something like:
... or die "Can't open '$logfilename' for appending: $!";
Or save yourself all that effort and let Perl do it for you with the
autodie pragma.
"carpout('LOG');"
Read the CGI::Carp documentation:
"The carpout() function requires one argument, a reference to an open filehandle for writing errors."
Your argument, 'LOG', is a literal string.
Does your script start with these two lines?
use strict;
use warnings;
If not, add them.
They may well highlight all sorts of problems you weren't aware of.
Like autodie,
strict and warnings
are two more examples of Perl doing the work for you, if you just ask.
Finally, kindly read "How do I post a question effectively?" and follow the instructions therein.
We're happy to help but we're not psychic:
if you provide the appropriate information, you'll usually get a quick response,
that actually answers your question,
rather than guesswork and requests for more information.
|