On Thu Jul 17 12:23:54 2014, MSTROUT wrote:
Show quoted text> On Wed Jul 16 18:06:17 2014, DROLSKY wrote:
> > I'm not a big fan of the $object->new. What is that supposed to mean?
> > Is it a clone? Is it a fresh constructor?
>
> Normal perl convention is for it to be equivalent to ref($object)->new
> IME.
>
> > What's wrong with (ref $object)->new at the call site to make it
> > clear
> > that you want to do create a new object of the same class as the old?
>
> Moose tried enforcing that for a while and it turned out to be more
> trouble than it was worth (and remember you're hearing that from the
> person who came up with strictures.pm :)
>
> While, generally, I tend to write ref($object)->new myself rather than
> simply $object->new, the convention that they should do the same thing
> is pretty well established and I'd argue that you might as well DWIM.
There was an effort a few (or more?) years back to rid the Perl core docs of the boilerplate that supported this idiom, and my impression is that most CPAN modules don't support this. It's possible that I'm the one who made many of the core doc changes, actually. I can't remember if this happened as part of my OO doc work or prior to it.
I don't care that much one way or the other but I don't really want to spend my time going through all my non-Moose CPAN modules adding support for this either ;)