summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-28 16:49:33 -0800
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-28 16:49:33 -0800
commita5f75d667838e8e7bb037880391f5c44476d33b4 (patch)
tree5005e888355c1508bc47da697efe119c1615b123 /lib/File
parent2920c5d2b358b11ace52104b6944bfa0e89256a7 (diff)
downloadperl-a5f75d667838e8e7bb037880391f5c44476d33b4.tar.gz
perl 5.002perl-5.002
[editor's note: changes seem to be mostly module updates, documentation changes and some perl API macro additions]
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/Copy.pm11
-rw-r--r--lib/File/Path.pm14
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm
index b4a075dbe1..62697456b7 100644
--- a/lib/File/Copy.pm
+++ b/lib/File/Copy.pm
@@ -24,6 +24,10 @@ sub copy {
croak("Usage: copy( file1, file2 [, buffersize]) ")
unless(@_ == 2 || @_ == 3);
+ # VMS: perform RMS copy to preserve file attributes, indices, etc.
+ # This function is always defined under VMS, even in miniperl
+ if (defined(&File::Copy::rmscopy)) { return File::Copy::rmscopy($_[0],$_[1]) }
+
my $from = shift;
my $to = shift;
my $recsep = $\;
@@ -99,11 +103,12 @@ sub copy {
1;
__END__
+
=head1 NAME
File::Copy - Copy files or filehandles
-=head1 USAGE
+=head1 SYNOPSIS
use File::Copy;
@@ -133,6 +138,10 @@ being written to the second file. The default buffer size depends
upon the file, but will generally be the whole file (up to 2Mb), or
1k for filehandles that do not reference files (eg. sockets).
+When running under VMS, this routine performs an RMS copy of
+the file, in order to preserve file attributed, indexed file
+structure, I<etc.> The buffer size parameter is ignored.
+
You may use the syntax C<use File::Copy "cp"> to get at the
"cp" alias for this function. The syntax is I<exactly> the same.
diff --git a/lib/File/Path.pm b/lib/File/Path.pm
index 6cb675b683..8a17173b0d 100644
--- a/lib/File/Path.pm
+++ b/lib/File/Path.pm
@@ -73,7 +73,8 @@ than VMS is settled. (defaults to FALSE)
=back
-It returns the number of files successfully deleted.
+It returns the number of files successfully deleted. Symlinks are
+treated as ordinary files.
=head1 AUTHORS
@@ -82,10 +83,13 @@ Charles Bailey <bailey@genetics.upenn.edu>
=head1 REVISION
-This document was last revised 25-Aug-1995, for perl 5.002
+This module was last revised 14-Feb-1996, for perl 5.002. $VERSION is
+1.01.
=cut
+$VERSION = "1.01"; # That's my hobby-horse, A.K.
+
require 5.000;
use Config;
use Carp;
@@ -95,7 +99,7 @@ require Exporter;
$Is_VMS = $Config{'osname'} eq 'VMS';
-sub mkpath{
+sub mkpath {
my($paths, $verbose, $mode) = @_;
# $paths -- either a path string or ref to list of paths
# $verbose -- optional print "mkdir $path" for each directory created
@@ -126,7 +130,7 @@ sub rmtree {
foreach $root (@{$roots}) {
$root =~ s#/$##;
- if (-d $root) {
+ if (not -l $root and -d _) {
opendir(D,$root);
($root = VMS::Filespec::unixify($root)) =~ s#\.dir$## if $Is_VMS;
@files = map("$root/$_", grep $_!~/^\.{1,2}$/, readdir(D));
@@ -147,7 +151,7 @@ sub rmtree {
next;
}
print "unlink $root\n" if $verbose;
- while (-e $root) { # delete all versions under VMS
+ while (-e $root || -l $root) { # delete all versions under VMS
(unlink($root) && ++$count)
or carp "Can't unlink file $root: $!";
}