Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: RFC: Converted Fiscal5253 from Classic OO Perl to Moo

by tobyink (Canon)
on Jul 03, 2014 at 11:32 UTC ( [id://1092155]=note: print w/replies, xml ) Need Help??


in reply to RFC: Converted Fiscal5253 from Classic OO Perl to Moo

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?

# lines 8 and 9... use Data::Dumper; $Data::Dumper::Indent = 1;

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.

Replies are listed 'Best First'.
Re^2: RFC: Converted Fiscal5253 from Classic OO Perl to Moo
by boftx (Deacon) on Jul 03, 2014 at 13:46 UTC
    Thanks for the feedback! Yeah, that was debugging I overlooked (again.) I'm somewhat notorious for that particular oversight at $work. I'm looking at the code to see if I can do something better than before new in a trait or role or whatever after hearing what others have said. Until then, it will work (hopefully.)
    You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1092155]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found