in reply to Issue with File::Copy and move
This is perl 5.32 on fedora 32
Using an older version of File::Copy (2.30) my SSCCE shows that the source file still exists. Perhaps try running this and see what happens?
use strict; use warnings; use Test::More tests => 4; use File::Copy 'move'; # Create a file my $src = '/tmp/foo.txt'; my $destdir = '/flurble'; open my $tmp, '>', $src or die $!; print $tmp "Hello, world!\n"; close $tmp; ok -e $src, "Source file $src exists"; ok ! -d $destdir, "Destination directory $destdir does not exist"; ok ! move ($src, "$destdir/bar.txt"), 'Move fails as expected'; ok -e $src, "Source file $src still exists";
Update: fixed open statement to use the $src variable.
🦛
|
|---|