X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FFileZIO.pm;h=e126b9495f1e68639224ff88d71094a923fcfc60;hp=05f28e6f4797ecf6e786f2038fcad7d86ca4b4cb;hb=f6257f558390295c581f4e5af8f084341db05d34;hpb=e9453b7611be63303572ae443d5fb56b73364678 diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index 05f28e6..e126b94 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 1.6.0_CVS, released 10 Dec 2002. +# Version 2.0.0beta2, released 13 Apr 2003. # # See http://backuppc.sourceforge.net. # @@ -95,9 +95,9 @@ sub open $fh = $fileName; } else { if ( $write ) { - open(FH, ">$fileName") || return; + open(FH, ">", $fileName) || return; } else { - open(FH, "<$fileName") || return; + open(FH, "<", $fileName) || return; } $fh = *FH; } @@ -246,6 +246,7 @@ sub write my $n = length($$dataRef); return if ( !$self->{write} ); + print($$dataRef) if ( $self->{writeTeeStdout} ); return 0 if ( $n == 0 ); if ( !$self->{compress} ) { # @@ -303,6 +304,14 @@ sub name return $self->{name}; } +sub writeTeeStdout +{ + my($self, $param) = @_; + + $self->{writeTeeStdout} = $param if ( defined($param) ); + return $self->{writeTeeStdout}; +} + sub close { my($self) = @_; @@ -343,7 +352,7 @@ sub compressCopy if ( $CompZlibOK && $compress > 0 ) { my $fh = BackupPC::FileZIO->open($destFileZ, 1, $compress); my $data; - if ( defined($fh) && open(LOG, $srcFile) ) { + if ( defined($fh) && open(LOG, "<", $srcFile) ) { while ( sysread(LOG, $data, 65536) > 0 ) { $fh->write(\$data); }