[Pdx-pm] standard for copy constructors in Moose?
Hans Dieter Pearcey
hdp.perl.pm.pdx at weftsoar.net
Tue Apr 26 18:10:40 PDT 2011
On Tue, 26 Apr 2011 17:56:07 -0700, Paul Liebert <paull at peak.org> wrote:
> This is like the third time I'm having to write a copy constructor so
> laziness got the best of me. Comments? Critiques? Pointers to std
> Moosian ways to do this etc.
http://search.cpan.org/~doy/Moose-2.0001/lib/Class/MOP/Class.pm#Object_instance_construction_and_cloning
http://search.cpan.org/~nuffin/MooseX-Clone-0.05/lib/MooseX/Clone.pm
Cloning is a tricky subject. Your copy method assumes that running the
constructor again is the right thing to do, but this isn't necessarily true;
RAII is one obvious case where it may be wrong.
hdp.
More information about the Pdx-pm-list
mailing list