The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tie::STDERR - Send output of your STDERR to a process or mail

SYNOPSIS

        use Tie::STDERR;
        if (;

        use Tie::STDERR 'root';
        
        use Tie::STDERR 'root', 'Errors in the script';
        
        use Tie::STDERR '>> /tmp/log';
        
        use Tie::STDERR '| mail -s Error root';

DESCRIPTION

Send all output that would otherwise go to STDERR either by email to root or whoever is responsible, or to a file or a process. This way you can change the destination of your error messages from inside of your script. The mail will be sent or the command run only if there actually is some output detected -- something like cron would do.

The behaviour of the module is directed via the arguments to use, as shown above. You can optionally give the name of the recipient and the subject of the email. Argument that starts with | will send the output to a process. If it starts with > or >>, it will be written (appended) to a file. If the argument is explicit undef, if will untie previous tieness.

My main goal was to provide a tool that could be used easily, especially (but not only) for CGI scripts. My assumption is that the CGI scripts should run without anything being sent to STDERR (and error_log, where it mixes up with other messages, even if you use CGI::Carp). I've found it usefull to get delivered any relevant information (%ENV) via email.

BUGS

The Tie::STDERR catches the compile time errors, but it doesn't get the reason, only the fact that there was an error.

VERSION

0.122

AUTHOR

(c) 1998 Jan Pazdziora, adelton@fi.muni.cz, http://www.fi.muni.cz/~adelton/ at Faculty of Informatics, Masaryk University in Brno, Czech Republic