I want to dump the output of Carp to a file handle in perl, instead of to stderr.
The file handle is already open.
What is the easiest way to do this?
example:
use strict;
use warnings;
use FileHandle;
use Carp;
my $fh = new FileHandle("log", "w") || croak "could not write 'log'";
# stuff happens
print $fh carp("stack trace");
close($fh);
The example will print "1" to the log, because that is the return value of carp.