You can write another function my_die inside your program and customize
according your requirements.
Something as below
Sub my_die() {
my $message = shift;
If ( $ENV{MY_ERR_LOG} ) {
open the file and write to it
} else {
die ("$message");
}
}
Steve Remme wrote:
> Is it possible to send the output from the 'die' and/or 'warn' commands
> to a file instead of stderr? Ideally, I would like this behavior to be
> configurable based on the existence of an environment variable.
>
> For example, if the environment variable MY_ERR_LOG is set