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

Re: Recommended file-copying method

Thread Previous | Thread Next
From:
David Golden
Date:
July 9, 2013 01:21
Subject:
Re: Recommended file-copying method
Message ID:
CAOeq1c9wAs0oUcUX4+DENbOC9N-jq3gbbzvv47=_bu1_PDf2gg@mail.gmail.com
On Mon, Jul 8, 2013 at 2:21 PM, Johan Vromans <jvromans@squirrel.nl> 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

--
David Golden <xdg@xdg.me>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About