X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFile%2FCopy.pm;h=31fad2ac5d6b2cc59cf71f522019add623d75cbf;hb=be6afa270448343c16f7ca13b43bcc64ac015945;hp=0a6ea8bfef8ced0800fbe8077e89c2d7ef0663a4;hpb=96a91e01636d3050d38ae3373a362c7d47a6647e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index 0a6ea8b..31fad2a 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -7,7 +7,7 @@ package File::Copy; -use 5.6.0; +use 5.006; use strict; use warnings; use Carp; @@ -24,7 +24,7 @@ sub mv; # package has not yet been updated to work with Perl 5.004, and so it # would be a Bad Thing for the CPAN module to grab it and replace this # module. Therefore, we set this module's version higher than 2.0. -$VERSION = '2.04'; +$VERSION = '2.05'; require Exporter; @ISA = qw(Exporter); @@ -72,10 +72,11 @@ sub copy { if ($Config{d_symlink} && $Config{d_readlink} && !($^O eq 'Win32' || $^O eq 'os2' || $^O eq 'vms')) { - if (-l $from || -l $to) { + no warnings 'io'; # don't warn if -l on filehandle + if ((-e $from && -l $from) || (-e $to && -l $to)) { my @fs = stat($from); my @ts = stat($to); - if ($fs[0] == $ts[0] && $fs[1] == $ts[1]) { + if (@fs && @ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) { croak("'$from' and '$to' are identical (not copied)"); } } @@ -128,8 +129,7 @@ sub copy { $size = shift(@_) + 0; croak("Bad buffer size for copy: $size\n") unless ($size > 0); } else { - no warnings 'uninitialized'; - $size = -s $from_h; + $size = tied(*$from_h) ? 0 : -s $from_h || 0; $size = 1024 if ($size < 512); $size = $Too_Big if ($size > $Too_Big); } @@ -333,9 +333,10 @@ File::Copy also provides the C routine, which copies the file specified in the first parameter to the file specified in the second parameter, preserving OS-specific attributes and file structure. For Unix systems, this is equivalent to the simple -C routine. For VMS systems, this calls the C -routine (see below). For OS/2 systems, this calls the C -XSUB directly. For Win32 systems, this calls C. +C routine, which doesn't preserve OS-specific attributes. For +VMS systems, this calls the C routine (see below). For OS/2 +systems, this calls the C XSUB directly. For Win32 systems, +this calls C. =head2 Special behaviour if C is defined (OS/2, VMS and Win32)