IO-File-AtomicChange
view release on metacpan or search on metacpan
lib/IO/File/AtomicChange.pm view on Meta::CPAN
$die ? croak "close atomic file: $!\n" : return;
}
}
1;
}
sub copy_modown_to_temp {
my($self) = @_;
my($mode, $uid, $gid) = (stat($self->_target_file))[2,4,5];
chown $uid, $gid, $self->_temp_file;
chmod $mode, $self->_temp_file;
}
sub backup {
my($self) = @_;
require Path::Class;
require POSIX;
require Time::HiRes;
lib/IO/File/AtomicChange.pm view on Meta::CPAN
$self->SUPER::close() unless ($self->_closed(1));
1;
}
sub copy_preserving_attr {
my($from, $to) = @_;
File::Copy::copy($from, $to) or croak $!;
my($mode, $uid, $gid, $atime, $mtime) = (stat($from))[2,4,5,8,9];
chown $uid, $gid, $to;
chmod $mode, $to;
utime $atime, $mtime, $to;
1;
}
1;
__END__
=encoding utf-8
( run in 1.096 second using v1.01-cache-2.11-cpan-71847e10f99 )