Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: How do you do OO in Perl?

by herveus (Parson)
on Oct 06, 2003 at 16:22 UTC ( #296982=note: print w/replies, xml ) Need Help??

in reply to How do YOU do OO in Perl?


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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://296982]
and John Coltrane plays...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-06-27 12:30 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (604 votes). Check out past polls.