in reply to error report

try something like this:
use Symbol 'gensym'; our $log = gensym; open $log, ">/path/to/logfile" or die $!; our $DEBUG = 1; sub add_log; local $SIG{__WARN__} = sub { &add_log(shift) }; local $SIG{__DIE__} = sub { &add_log(shift); exit 1 }; sub add_log { print $log, shift(); flush $log if $DEBUG; } sub DESTROY { close $log; }
admitted this is more of a rough draft, but the method should be clear from these few lines.
--------------------------------
masses are the opiate for religion.