Hi Pablo,
pa...@compugenic.com wrote:
STDERR is where errors go. Error messages are generated as a result of
an error, not a 'print' statement. Athough I could manually print to
STDERR, I'm trying to log all errors to both a logfile and STDERR.
Hmmmmm, not quite sure what you mean. Errors in your script are shown
because you've added a check for it (using an "if" statement) and then
printed it using "print" to (say) STDERR. I mean, the script doesn't
"know" what is an error or not...it is up to the programmer to decide
what message to send to STDERR and what to STDOUT.
If you're talking about the system log files in /var/log, then the
difference is just that someone else made the decision for you for their
program. But whatever the program, someone, and not the program, had to
decide what goes to STDERR...
However, about the logfile, what you are asking sounds like you are
looking for this module:
http://perldoc.perl.org/Sys/Syslog.html
(which I've never used, so I can't help you with it). I don't know if
there is a function in this module to send messages to both a log file
and STDERR...my guess is that there isn't and you will have to make two
statements yourself to do it.
Hope this helps...
Ray
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/