Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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


Comment on Re: command move and qq{}
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://675505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2015-07-04 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls