in reply to Procedural vs OOP modules
My recommendation is to go with the "oop" interface but only for the instantiation of the "object" and for providing accessors for the fields. I'll also add, that when I see use a module that doesn't provide this, it feels a little yucky. Beyond that, Perl "OOP" fur real is the domain of an extremely vocal but tiny minority. It is very true that going beyond the means for instantiating the "object" and providing accessors necessarily yields code that looks - and behaves - like a completely different language. Again, going back to my experience with Util::H2O I've been able to summarize my desire for "improving" OOP support in Perl to go no further than a better bless that provides the kinds of things h2o provides, but can still be used in the same way - h2o comes close to achieving this but to get the last bits of what I want requires non-idiomatic tricks.
Namely, a) using h2o to define a "class" and b) taking an already blessed reference and adding accessors to it as easily as it does for non-blessed hash references. What I really want is to be able to have a bless that can magically add accessors like h2o, but that can also be used to do surgery on already blessed references - and also remain the basis for which "OOP" modules get OOP'd.
|
---|