[sf-perl] the mouse with antlers

Bill Moseley moseley at hank.org
Thu Apr 5 03:37:15 PDT 2012

On Thu, Apr 5, 2012 at 11:45 AM, Jeffrey Thalhammer <
jeff at imaginative-software.com> wrote:

> Side note:  I've been hanging out on the #moose channel lately.
>  Apparently, lazy_build is out of fashion, because it also generates a
> predicate and clearer method for you, which you probably didn't want.  So
> now the recommended practice is...
> has id => ( lazy => 1,  builder => '_build_id' );
> I think lazy_build will be removed from the documentation in the next
> release of Moose.

Seems to still be there in the lates trial release from a day or so ago,
but there is now a note in the Best Practices docs.

The reasoning is because it automatically creates (possibly undocumented)
methods that someone might use in your public API that might not be part of
the test suite?

I used to specify "builder" but got caught leaving out the lazy => 1 a few
times, and quite a few times typed the builder method name incorrectly. And
I also missed the predicate that I use, if only infrequently.  And there's
a lot to be said for laziness.

Time to start using MooseX::AttributeShortcuts, indeed.

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20120405/5ee24346/attachment.html>

More information about the SanFrancisco-pm mailing list