in reply to Capturing both STDERR and STDOUT without shell redirect
Here's some code I've used that implements nimdokk's suggestion above:
open my $log_writer, '>>', $log_file; *STDOUT = $log_writer; *STDERR = $log_writer;
where of course you have to set $log_file first. I liked this approach enough to put it in the import sub of a module I named Log::Simple.
I'm sure there are better implementations of this idea on CPAN.
|
|---|