develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Recommended file-copying method

Thread Previous | Thread Next
David Golden
July 9, 2013 01:21
Re: Recommended file-copying method
Message ID:
On Mon, Jul 8, 2013 at 2:21 PM, Johan Vromans <> wrote:
> As stated earlier, this operation should be classified as a store or put
> or write, since it applies to data. Copy, OTOH, would imply making an
> identical copy (including file properties) of a file object from the
> file system.
> Please let's not make the already existing confusion bigger.
> This is the change to improve on a API.

I disagree with your point that copy "would imply making an identical
copy (including file properties)" because that's simply your
particular point of view on it.  Copying file properties is not always
easy or possible, depending on ownership, permissions, filesystem,
operating system, etc.

Even /bin/cp doesn't preserve properties by default and that's what a
lot of people think of when they think about file copying semantics.
The first sentence of my man page for it says "...the cp utility
copies the contents of the source_file to the target_file".  (Note the
"contents" there.)

So I think what "copy" means is different for different users in
different situations.  I think File::Copy does a fair job of providing
various alternatives.  I think it has some weird and/or unsafe
behaviors that are unfortunate to have in the Perl core.  (Oh well,
back compatibility pretty much screws us there.)

If Ken wants to offer a version of a "copy" operation in Path::Class,
as long as it's documented clearly what it does and what its
limitations are, I don't think it's going to be any more confusing to
people than File::Copy already is.


David Golden <>
Take back your inbox! →
Twitter/IRC: @xdg

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About