Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: cp -p in perl?

by BuddhaNature (Beadle)
on Apr 20, 2004 at 23:37 UTC ( [id://346829]=note: print w/replies, xml ) Need Help??


in reply to Re: cp -p in perl?
in thread cp -p in perl?

It looks like (so far) the best way to do this is to do all your work on a tempfile ( I like File::Temp myself) version of the file you want to copy and then do your chmod and/or chown on the tempfile and then use rename(). This seems to work correctly.

Replies are listed 'Best First'.
Re: cp -p in perl?
by Abigail-II (Bishop) on Apr 21, 2004 at 08:01 UTC
    That doesn't sound like a good idea at all to me. First of all, we're talking about just copying a file, not about any modification. Secondly, using chmod/chown is a lot more work than just using cp. But most importantly, rename will not rename from one device to another.

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found