Mo::builder fails to pass $self to builder method when 'lazy => 0'
Opened this issue · 2 comments
See the test in my issue/28 branch (mlawren/mo-pm) which I will reference here somehow when I figure how to make github do that. Short version is this:
has x => (
lazy => 0,
builder => '_builder',
)
Results in _builder() not receiving a first argument.
My second commit (781601b) also tests the behaviour when Mo::nonlazy is used, which has the same problem.
I don't know what the right fix here is.
One could argue that the builder/lazy=0 combination is the same as using the 'default' option, except that sometimes default/builder subs can be quite long and you don't always want to have to stuff that all into the 'has' argument list. If Mo isn't going to support builder/lazy=0 then it should at least complain in 'has'.
Otherwise the fix is to make sure Mo always calls the builder method with $self.