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.
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.