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

Re: Recommended file-copying method

Thread Previous | Thread Next
From:
Mark Overmeer
Date:
July 7, 2013 14:44
Subject:
Re: Recommended file-copying method
Message ID:
20130707144424.GA3200@moon.overmeer.net
* Leon Timmermans (fawaka@gmail.com) [130707 14:04]:
> On Sun, Jul 7, 2013 at 5:20 AM, Ken Williams <kenahoo@gmail.com> wrote:
> > I'm about to add a $file->copy($destination) method to Path::Class.  I was
> > about to use File::Copy's copy() function, but then I noticed the cp() and
> > syscopy() alternatives, each of which has additional niceties (the former
> > preserves permissions - the latter seems to DTRT better on Windows and other
> > non-Unixalikes) but neither has both niceties people probably want.
> 
> I don't think this makes much sense as a method. Copying is not an
> operation of one subject, but one of two equals. Or said otherwise,
> why would it be a method of the source and not of the destination?

Copy is like clone(), but on file-system level.  When you accept that a
file is just a (complex) data-type like any other,
$file->copy($destination) is the obvious syntax.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark@Overmeer.net                          solutions@overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net


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