X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXDebug.pm;h=64ed843944d7d478c4466f541933e75bca0af418;hb=cc91428ca79b3cdfdc7733505384f5983ad6c7fa;hp=c03f92af8b18308c1c32d52bd8affeae59024377;hpb=cce161221036760959ff1d0b7628a55942bf558a;p=spider.git diff --git a/perl/DXDebug.pm b/perl/DXDebug.pm index c03f92af..64ed8439 100644 --- a/perl/DXDebug.pm +++ b/perl/DXDebug.pm @@ -25,17 +25,29 @@ use Carp; %dbglevel = (); $fp = DXLog::new('debug', 'dat', 'd'); +# add sig{__DIE__} handling +if (!defined $DB::VERSION) { + $SIG{__WARN__} = $SIG{__DIE__} = sub { + my $t = time; + for (@_) { + $fp->writeunix($t, "$t^$_"); +# print STDERR $_; + } + }; +} + sub dbg { my $l = shift; if ($dbglevel{$l}) { - for (@_) { - s/\n$//og; + my @in = @_; + my $t = time; + for (@in) { + s/\n$//o; s/\a//og; # beeps + print "$_\n" if defined \*STDOUT; + $fp->writeunix($t, "$t^$_"); } - print "@_\n" if defined \*STDOUT; - my $t = time; - $fp->writeunix($t, "$t^@_"); } }