Syntactic Confectionery Delight | |
PerlMonks |
Re: How do you do OO in Perl?by herveus (Prior) |
on Oct 06, 2003 at 16:22 UTC ( [id://296982]=note: print w/replies, xml ) | Need Help?? |
Howdy!
One way to sort methods is "hand-rolled" versus "automated". Class::Struct (IIRC) is an example of automated, but you can't subclass (or was that "use it in a subclass"?); it has restrictions on extensibility that might preclude its use. Class::MakeMethods and Class::MethodMaker each offer extensive choices in what you make and how the innards of your class work. I've used one of them (I forget right now which one it was). I've hand-rolled hash-based classes as well as ones based on other storage methods -- sort-of inside-out. I don't think I've gone so far as to meaningfully reinvent the wheel in automated generation. Recently, I got a week of Java training at work. I behaved myself. Java presented some interesting ideas along with the (IMO) excessive bondage and discipline. I see Java having influence on my Perl programming (in a good way). Of course, (not intending to do the language flame thing) some of the contortions one must go through in Java are related to the fact that everything is an object...well, almost...unless it is a primitive data type... On the other hand, it has broadened my horizons on setting things up, and led me to consider how to steal from Class::*mumble* to make a Class::Java::Autogenerate or something that will create class files with the scut-work done automagically to write the accessor/mutators and declare the attributes and whatever else comes to mind to autogenerate.
yours, Michael
In Section
Meditations
|
|