Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: File::Copy versus cp/mv

by Aristotle (Chancellor)
on Oct 01, 2003 at 16:49 UTC ( #295687=note: print w/replies, xml ) Need Help??


in reply to File::Copy versus cp/mv

Depends. Are you doing this from within a performance critical program? If this were code running under mod_perl, f.ex, I wouldn't be pleased that someone forks an entire Apache willy nilly.

But if they're simple maintenance scripts or such, there's not much wrong in using the Unix toolbox if Unix is what you're going to run on.

There's something they need convincing of though: avoid the shell whenever you can reasonably do so.

system(cp => $foo, $bar); system(mv => $foo, $bar);
And if filenames can contain metacharacters, glob them yourself. Going through the shell can easily cause unexpected behaviour if you're not careful, and it's very easy to not be careful enough.

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2018-02-24 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?