projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
disconnect channels whose route node has disappeared
[spider.git]
/
perl
/
DXLog.pm
diff --git
a/perl/DXLog.pm
b/perl/DXLog.pm
index 8e2fc66febaa2021d06fa641bc8771cace0d9708..9f15c225f40dea9a01f7ce5b5aae8e9110fab522 100644
(file)
--- a/
perl/DXLog.pm
+++ b/
perl/DXLog.pm
@@
-29,11
+29,11
@@
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(Log Logclose);
@ISA = qw(Exporter);
@EXPORT = qw(Log Logclose);
-use
FileHand
le;
+use
IO::Fi
le;
use DXVars;
use DXVars;
-use DXDebug ();
use DXUtil;
use Julian;
use DXUtil;
use Julian;
+
use Carp;
use strict;
use Carp;
use strict;
@@
-53,7
+53,7
@@
sub new
$ref->{'sort'} = $sort;
# make sure the directory exists
$ref->{'sort'} = $sort;
# make sure the directory exists
- mkdir($ref->{prefix}, 0777)
if !
-e $ref->{prefix};
+ mkdir($ref->{prefix}, 0777)
unless
-e $ref->{prefix};
return bless $ref;
}
return bless $ref;
}
@@
-75,7
+75,7
@@
sub open
$mode = 'r' if !$mode;
$self->{mode} = $mode;
$mode = 'r' if !$mode;
$self->{mode} = $mode;
- my $fh = new
FileHand
le $self->{fn}, $mode, 0666;
+ my $fh = new
IO::Fi
le $self->{fn}, $mode, 0666;
return undef if !$fh;
$fh->autoflush(1) if $mode ne 'r'; # make it autoflushing if writable
$self->{fh} = $fh;
return undef if !$fh;
$fh->autoflush(1) if $mode ne 'r'; # make it autoflushing if writable
$self->{fh} = $fh;
@@
-83,7
+83,7
@@
sub open
$self->{year} = $year;
$self->{thing} = $thing;
$self->{year} = $year;
$self->{thing} = $thing;
-
DXDebug::dbg("dxlog", "opening $self->{fn}\n
");
+
# DXDebug::dbg("opening $self->{fn}\n") if isdbg("dxlog
");
return $self->{fh};
}
return $self->{fh};
}
@@
-161,7
+161,14
@@
sub close
{
my $self = shift;
undef $self->{fh}; # close the filehandle
{
my $self = shift;
undef $self->{fh}; # close the filehandle
- delete $self->{fh};
+ delete $self->{fh};
+}
+
+sub DESTROY
+{
+ my $self = shift;
+ undef $self->{fh}; # close the filehandle
+ delete $self->{fh} if $self->{fh};
}
# log something in the system log
}
# log something in the system log