projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed FileHandle to IO::File in cmds
[spider.git]
/
perl
/
DXLog.pm
diff --git
a/perl/DXLog.pm
b/perl/DXLog.pm
index dde723027f5b237afd735c4452eeafd1b7a42a02..8281e154e86f6998ecbc25d48d5652de9be76c28 100644
(file)
--- a/
perl/DXLog.pm
+++ b/
perl/DXLog.pm
@@
-27,9
+27,9
@@
package DXLog;
require Exporter;
@ISA = qw(Exporter);
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(Log);
+@EXPORT = qw(Log
Logclose
);
-use
FileHand
le;
+use
IO::Fi
le;
use DXVars;
use DXDebug ();
use DXUtil;
use DXVars;
use DXDebug ();
use DXUtil;
@@
-75,7
+75,7
@@
sub open
$mode = 'r' if !$mode;
$self->{mode} = $mode;
$mode = 'r' if !$mode;
$self->{mode} = $mode;
- my $fh = new
FileHandle $self->{fn}, $mode
;
+ my $fh = new
IO::File $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;
@@
-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
@@
-174,10
+181,8
@@
sub Log
$log->writeunix($t, join('^', $t, @_) );
}
$log->writeunix($t, join('^', $t, @_) );
}
-sub
DESTROY # catch undefs and do what is required further down the tre
e
+sub
Logclos
e
{
{
- my $self = shift;
- DXDebug::dbg("dxlog", "closing $self->{fn}\n");
- undef $self->{fh} if defined $self->{fh};
-}
+ $log->close();
+}
1;
1;