Module Tie::STDERR catches outputs that go to standard error output and sends them via email, or writes them to file or to a process. The email is sent or program run only if there actually is some output, like cron does it.
If you use the line
at the start of your script (and maybe CGI script), any output that would go to STDERR will be sent by email to root. You can specify the recipient, for example
use Tie::STDERR 'adelton';
would send the message to me.
Alternatively, you can pipe the output to some other process or append the output to some file:
use Tie::STDERR '| logger ...';
use Tie::STDERR '>> /tmp/testing.log';
The module will catch all output, including your explicit prints to STDERR, warnings about undefined values, dies and even dies as a result of compilation error. You do not need any special treatment/functions -- Tie::STDERR will catch all. Now, this also works in mod_perl/Apache::Registry scripts
Copyright: (c) 1998 Jan Pazdziora.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.