Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: command move and qq{}

by doc_faustroll (Scribe)
on Mar 21, 2008 at 19:12 UTC ( #675505=note: print w/replies, xml ) Need Help??

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:

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 $?"); } }
However, in the specific case of a move, I prefer File::Copy and for mkdir I prefer File::Path.
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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://675505]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-02-24 06:52 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.