Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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?

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


Comment on Re: How do you do OO in Perl?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-09-20 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (161 votes), past polls