From 9c73c56e9ef6d00631d8e5e4feaec5ef13c37b09 Mon Sep 17 00:00:00 2001 From: "Andreas J. Koenig" Date: Sun, 12 Oct 2008 07:00:34 +0200 Subject: [PATCH] refactor into new sub ..._unhide because I want to talk about unhiding --- lib/File/Rsync/Mirror/Recentfile.pm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/File/Rsync/Mirror/Recentfile.pm b/lib/File/Rsync/Mirror/Recentfile.pm index 19bdc8e..ea2522a 100644 --- a/lib/File/Rsync/Mirror/Recentfile.pm +++ b/lib/File/Rsync/Mirror/Recentfile.pm @@ -959,16 +959,7 @@ sub mirror { } # once we've gone to the end we consider ourselve free of obligations $self->_seeded(0); - my $rfile = $self->rfile; - unless (rename $trecentfile, $rfile) { - require Carp; - Carp::confess("Could not rename '$trecentfile' to '$rfile': $!"); - } - $self->_use_tempfile (0); - if (my $ctfh = $self->_current_tempfile_fh) { - $ctfh->unlink_on_destroy (0); - $self->_current_tempfile_fh (undef); - } + $self->_mirror_unhide_tempfile ($trecentfile); return !@error; } @@ -1118,6 +1109,21 @@ sub _mirror_register_path { } } +sub _mirror_unhide_tempfile { + my($self, $trecentfile) = @_; + my $rfile = $self->rfile; + unless (rename $trecentfile, $rfile) { + require Carp; + Carp::confess("Could not rename '$trecentfile' to '$rfile': $!"); + } + $self->_use_tempfile (0); + if (my $ctfh = $self->_current_tempfile_fh) { + $ctfh->unlink_on_destroy (0); + $self->_current_tempfile_fh (undef); + } + +} + =head2 (void) $obj->mirror_loop Run mirror in an endless loop. See the accessor C. XXX -- 2.11.4.GIT