in reply to how i capture a script error to a file ?

In the scripts that I've been writing recently (data-munging under the guise of ETL), I've been opening an error log and then using that everywhere to log stuff as I go through.

# Somewhere early on, so that it can be used everywhere. my $error_log; ... # I don't use 'or die' here because I use autodie. open ( $error_log, '>', 'errors.log' ); ... # Later, wherever it's necessary .. print $error_log "$unique_identifier" . "$useful_variables $more useful variables\n";
So, you could use this approach by replacing
system qq(echo "$message" >> log.err);
in your own die case with
print $error_log "$message\n";
Exiting the program will close the error log filehandle. Then you can tail the error log and see what happened.

There's another debate as to the necessity of crafting your own die handler .. but I'll leave that question unasked.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.