in reply to command move and qq{}
Here is a suggestion, if not a specific answer. In the general case of system calls, system is generally preferable. as in:
However, in the specific case of a move, I prefer File::Copy and for mkdir I prefer File::Path.my $command = qq{syscall $interp}; run_command_string($command); sub run_command_string { my $command = shift; $log->info("attempt to run the following command:"); $log->info("$command"); system $command; if ( $? == -1 ) { $log->error("failed to execute: $!\n"); } elsif ( $? & 127 ) { $log->error("child died with signal $? $!"); } else { $log->info("child exited with value $?"); } }
use File::Copy; use File::Path; #my $filename, $file2 declared somewhere move( "$filename", "$file2" ) or die "move failed: $!"; #check File::Path's mkpath for use
|
---|