<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">SYNOPSIS

     use Tie::Handle::FileWriteRotate;
     tie *FH, 'Tie::Handle::FileWriteRotate',
         dir=&gt;'/some/dir', prefix=&gt;'myapp', size=&gt;25*1024*1024, histories=&gt;5;
     print FH "Logging a line\n";
     print FH "Logging another line\n";

DESCRIPTION

    This module ties a filehandle to File::Write::Rotate object.

    I first wrote this module to tie STDERR, so that warnings/errors are
    logged to file instead of terminal (with autorotation, for good
    behavior).

METHODS

 TIEHANDLE classname, LIST

    Tie this package to file handle. LIST will be passed to
    File::Write::Rotate's constructor.

TIPS

    To log warnings/errors to terminal as well as autorotated file, you can
    do something like this instead:

     my $fwr = File::Write::Rotate-&gt;new(...);
     $SIG{__WARN__} = sub {
         $fwr-&gt;write(~~localtime, " ", $_[0], "\n");
         warn $_[0];
     };
     $SIG{__DIE__} = sub {
         $fwr-&gt;write(~~localtime, " ", $_[0], "\n");
         die $_[0];
     };

SEE ALSO

    File::Write::Rotate

</pre></body></html>