Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: command move and qq{}

by doc_faustroll (Scribe)
on Mar 21, 2008 at 19:12 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found