projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make disconnects use $conn->eproc
[spider.git]
/
perl
/
DXDebug.pm
diff --git
a/perl/DXDebug.pm
b/perl/DXDebug.pm
index a1c63407f71f1b2aba38c58782dbe77f0a73e63b..b55d01fcf5ea8de4fa060321e12195468274d8cc 100644
(file)
--- a/
perl/DXDebug.pm
+++ b/
perl/DXDebug.pm
@@
-21,7
+21,7
@@
use DXLog ();
use Carp qw(cluck);
%dbglevel = ();
use Carp qw(cluck);
%dbglevel = ();
-$fp =
DXLog::new('debug', 'dat', 'd')
;
+$fp =
undef
;
# Avoid generating "subroutine redefined" warnings with the following
# hack (from CGI::Carp):
# Avoid generating "subroutine redefined" warnings with the following
# hack (from CGI::Carp):
@@
-56,6
+56,8
@@
sub _store
chomp;
my @l = split /\n/;
for (@l) {
chomp;
my @l = split /\n/;
for (@l) {
+ my $l = $_;
+ $l =~ s/([\x00\x08\x0B-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg;
print "$_\n" if defined \*STDOUT;
$fp->writeunix($t, "$t^$_");
}
print "$_\n" if defined \*STDOUT;
$fp->writeunix($t, "$t^$_");
}
@@
-69,18
+71,21
@@
sub dbginit
$SIG{__WARN__} = sub { _store($@, Carp::shortmess(@_)); };
$SIG{__DIE__} = sub { _store($@, Carp::longmess(@_)); };
}
$SIG{__WARN__} = sub { _store($@, Carp::shortmess(@_)); };
$SIG{__DIE__} = sub { _store($@, Carp::longmess(@_)); };
}
+
+ $fp = DXLog::new('debug', 'dat', 'd');
}
sub dbgclose
{
$SIG{__DIE__} = $SIG{__WARN__} = 'DEFAULT';
}
sub dbgclose
{
$SIG{__DIE__} = $SIG{__WARN__} = 'DEFAULT';
- $fp->close();
+ $fp->close() if $fp;
+ undef $fp;
}
sub dbg
{
my $l = shift;
}
sub dbg
{
my $l = shift;
- if ($
dbglevel{$l} || $l eq 'err'
) {
+ if ($
fp && ($dbglevel{$l} || $l eq 'err')
) {
my @in = @_;
my $t = time;
for (@in) {
my @in = @_;
my $t = time;
for (@in) {