P is for Practical | |
PerlMonks |
Re: RFC: Converted Fiscal5253 from Classic OO Perl to Mooby tobyink (Canon) |
on Jul 03, 2014 at 11:32 UTC ( [id://1092155]=note: print w/replies, xml ) | Need Help?? |
Not a massive fan of the before new bit. This is something that I think ought to be handled in Moo itself; either by making $instance->new(%params) do something useful, or by making it die with a sensible error message. Not sure what lines 8 and 9 are supposed to be doing. Did you put them in for debugging and forget to remove them?
Other than that, looks good. I like the use of coderefs for private methods. I've been using this technique increasingly myself, having found the "private methods begin with an underscore" convention inadequate (too easy to accidentally override private methods in a superclass). When I write about methods in my book I plan on promoting a four-level method privacy convention similar to .NET (private/protected/friend/public). Private methods would be coderefs in lexical variables.
In Section
Meditations
|
|