Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
In theory, $obj->new( ... ) is ambiguous and should be avoided. Very often, in practice, the meaning of $obj->new( ... ) is obvious and useful. The bigger mistake is using a method generator, especially one that leaks information that should be internal to the implementation (the attribute names) to the external interface (including the constructor). A bigger mistake than that is even contemplating "before" hooks. And some (but not all) of the reasons why they are a horrible method of abstraction are actually demonstrated above. But, yes, I have several times implemented class-only (and even more likely, object-only) methods. I'm most likely to do that by having a different package for class methods vs object methods. I encourage you to take a step back and give more thought to your primary goals and reassess your secondary goals. In this context, OO purity is a secondary goal, one meant to be a shortcut to evaluating likely usefulness toward primary goals, mostly modular design. Moose is anti-modular. If you avoid all of the anti-modular features of Moose (which you can), then you are left with no benefits (but real overhead costs). - tye In reply to Re: $class = ref($class) if ref($class) Redux (theory)
by tye
|
|