App-RegexFileUtils
view release on metacpan or search on metacpan
share/ppt/cp.pl view on Meta::CPAN
open(PATH, "<$path") or die "Unable to read $path: $!";
open(TARGET, ">$target") or die "Unable to create $target: $!";
if ($cp::BINMODE) { binmode PATH; binmode TARGET; }
my $buffer;
while (read PATH, $buffer, 1024) { print TARGET $buffer; }
close PATH;
close TARGET;
if ($PRESERVE) ## preserve as many file attributes as possible...
{
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $path;
utime $atime, $mtime, ($target);
chown $uid, $gid, ($target);
my $oldMode = (07777 & $mode); ## from man -s 2 mknod
chmod $oldMode, $target;
}
}
################################################################################
## print Insufficient arguments error
sub insufficientArgs($)
{
my $arg_num = ($_[0] + 1); ## num to display
share/ppt/rm.pl view on Meta::CPAN
# Delete the file.
unlink( $fileName );
}
#
# Overwrite the file specified, first with x00, the xFF, then x00
sub overWriteFile( )
{
my ( $fileName ) = @_;
# Info returned from stat
my ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size );
# Text we print to the file to overwrite its contents
my ( $text, $FILEHANDLE, $ff );
# We only want the size
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size ) = stat $fileName;
$ff = "\0xFF";
# Change mode if the file is readonly.
if ( !-w $fileName )
{
my ( $mode ) = "0777";
chmod $mode, $fileName;
}
( run in 2.399 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )