DiaColloDB

 view release on metacpan or  search on metacpan

DiaColloDB/Utils.pm  view on Meta::CPAN

    return File::Copy::syscopy($src,$dst,3);
  }
  ##-- copy and then manually propagate file attributes
  my $rc = File::Copy::copy($src,$dst) or return undef;
  $dst = "$dst/".basename($src) if (-d $dst);
  my @stat = stat($src);
  my ($perm,$gid,$atime,$mtime) = @stat[2,5,8,9];
  my $uid = $>==0 ? $stat[4] : $>;  ##-- don't try to set uid unless we're running as root
  $rc &&= CORE::chown($uid,$gid,$dst)
      or $that->warn("cp_a(): failed to propagate ownership from '$src' to '$dst': $!");
  $rc &&= CORE::chmod(($perm & 07777), $dst)
      or $that->warn("cp_a(): failed to propagate persmissions from '$src' to '$dst': $!");
  $rc &&= CORE::utime($atime,$mtime,$dst)
      or $that->warn("cp_a(): failed to propagate timestamps from '$src' to '$dst': $!");
  return $rc;
}

## $fh_or_undef = PACKAGE->fh_flush($fh)
##  + flushes filehandle $fh using its flush() method if available
sub fh_flush {
  shift if (UNIVERSAL::isa($_[0],__PACKAGE__));

DiaColloDB/Utils.pod  view on Meta::CPAN


 $bool = PACKAGE->cp_a($src,$dst);

Copies a single file C<$src> to C<$dst>, attempting to preserve ownership, permissions, and timestamps;
used by L<copyto_a()|/copyto_a>.
Uses L<File::Copy::syscopy()|File::Copy/syscopy> if available and distinct from
L<File::Copy::copy()|File::Copy/copy>, otherwise first copies the file using
L<File::Copy::copy()|File::Copy/copy> and subsequently propagates file attributes using
the core perl functions
L<chown()|perlfunc/chown>,
L<chmod()|perlfunc/chmod>,
and L<utime()|perlfunc/utime>.

=item fh_flush

 $fh_or_undef = PACKAGE->fh_flush($fh);

flushes filehandle $fh using its flush() method if available

=item fh_reopen



( run in 0.390 second using v1.01-cache-2.11-cpan-8d75d55dd25 )