--- "Daniel J. Rychlik" <[EMAIL PROTECTED]> wrote:
> I have been a perl developer or about a year and half and I have a question.  How 
> come perl does
> not support the use of Class Objects ?  

Hi Dan,

Much of Perl's OO support is currently clumsy.  Perl has taken the "simplest thing 
that can
possibly work" philosophy and applied it to OO.  While this means that Perl's OO is 
very easy to
use, it also means that it's cumbersome in many ways.

Personally, I've had great success treating a class as an object and having my 
instances inherit
from the class object.  That allows me to have inheritable class data, a handy place 
for class
methods and, in general, just a nice separation of a few things that are nice to 
separate (was
that suitably vague for you?).

Unfortunately, until we get to Perl6, this is at best a hack.

You can also check out the module Class::Data::Inheritable if that's what you're 
really looking
for (which is what most people mean when they say they want class objects).  Not only 
does that
allow for inheritable class data, it also allows you to override that class data for a 
specific
instance.  This is not allowed in some OO languages, but if you need it, you need it.

For example, you have a Universe class and clearly PI must be ~3.1415927 for all 
instances.  PI is
class data.  However, you find you need to instantiate the "Roman" (or Arkansas ;) 
universe and
those pesky people insist upon having 3 for the value of PI.  All of a sudden, it's 
cleaner to be
able to override this.  Class::Data::Inheritable allows you to do that.

Cheers,
Ovid

=====
Hire me!                   http://users.easystreet.com/ovid/personal/resume.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to