sub cp;
sub mv;
-$VERSION = '2.15';
+$VERSION = '2.16';
require Exporter;
@ISA = qw(Exporter);
my @fs = stat($from);
if (@fs) {
my @ts = stat($to);
- if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) {
+ if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1] && !-p $from) {
carp("'$from' and '$to' are identical (not copied)");
return 0;
}
my $TB = Test::More->builder;
-plan tests => 459;
+plan tests => 461;
# We're going to override rename() later on but Perl has to see an override
# at compile time to honor it.
}
}
+SKIP: {
+ skip("fork required to test pipe copying", 2)
+ if (!$Config{'d_fork'});
+
+ open(my $IN, "-|") || exec $^X, '-e', 'print "Hello, world!\n"';
+ open(my $OUT, "|-") || exec $^X, '-ne', 'exit(/Hello/ ? 55 : 0)';
+
+ ok(copy($IN, $OUT), "copy pipe to another");
+ close($OUT);
+ is($? >> 8, 55, "content copied through the pipes");
+ close($IN);
+}
+
END {
1 while unlink "file-$$";
1 while unlink "lib/file-$$";