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


by rand (Initiate)
on Mar 03, 2000 at 21:25 UTC ( #4800=perlquestion: print w/replies, xml ) Need Help??

rand has asked for the wisdom of the Perl Monks concerning the following question:

let's face it, perl wasn't built for object orientation. nevertheless a time may come when you're forced to think about it - especially when designing and building a medium to large scale application... i have been through the perltoot and some o'reilly books but in combination with apache and modperl, the whole thing starts to get real tricky. what are your experiences. is perl and oo feasable ? is oo and mod_perl a contradiction ? do you use oo anyway ? which oo-features are the most important ? use the source, luke !

Replies are listed 'Best First'.
Re: ooperl
by Crulx (Monk) on Mar 04, 2000 at 06:27 UTC
    I agree with btrott. (Me too! *grin*) Perl handles object oriented programming very well. I have done several successful projects using OO perl. In fact, perl handles every major OO feature that you could possibly need.
    OO and mod_perl work fine. Follow the basic rules for function building that you normally would use in mod perl and you will be fine.
    The only real thing "OO" thing that perl doesn't do is information hiding. Perl like information to be there (in the form of hash keys usually), so any information hiding that you do "need" to do will be through the documentation. As long as you have programmed something in an encapsulated manner and document it correctly, if someone uses your class in a manner not specified by documentation, they will suffer the consiquences (version issues, strange behavior). Other than that, perl is wonderful and very free object oriented language.
    Try out some oo programming in perl... you will find it to your liking.
Re: ooperl
by btrott (Parson) on Mar 03, 2000 at 23:39 UTC
    Well, I'm not necessarily sure that's something we just have to "face". Perl may not have originally been built for object orientation, but its OO model is quite simple, powerful, and can be very useful.

    Do you have any specific complaints about the OO model in Perl (other than it "getting tricky")?

    I use Perl's OO model quite a lot, and I find it very useful and easy to use. I have no problems using it under mod_perl, either.

    I think you should perhaps do a bit more reading up on the subject, try out some OO perl, and see what you think then. Here are some starting points:

    Bless My Referents, by Damian Conway. You should also take a look at his book, Object Oriented Perl, which comes highly recommended. There are some sample chapters online.

    perlboot; I don't know your level of familiarity w/ OO techniques, but this is Randal's alternate (as in alternate to perltoot) intro to OO programming in Perl.

Re: ooperl
by Anonymous Monk on Mar 04, 2000 at 06:44 UTC
    I also have found perl to be very easy for creating OO type programs. I don't see how anyone could say "perl wasn't built for object orientation", unless they are using a version perhaps 2 years out-of-date. Perhaps the real issue here is this programmer's OO skills or a lack of perl familiarity? Tarkus
Re: ooperl
by nickcave25 (Acolyte) on Mar 05, 2000 at 09:32 UTC
    I am hoping (someday) to be an expert in OOPerl. One really good Perl book I'm reading right now (and I just noticed that btrott refers to it in one of the posts above) is _Object Oriented Perl_.

    Here's a link to its official website:

    It comes very well recommended by the usual Perl luminaries. I have read the first two chapters and so far I am impressed by how well it is written and how (relatively) easy it is to follow.
Re: ooperl
by stephen (Priest) on Mar 06, 2000 at 02:58 UTC
    Hmm... I use Perl's object oriented model heavily. Yes, Perl could use some UML tools (as well as a refactoring browser, but that's off-topic.) It sounds like an ideal open-source project. Anyone want to work with me on that one?

    I don't think we need to harsh on rand (the original poster) for saying that Perl's OO features weren't designed as a core part of the language. They're there, and they work, but the object model isn't as easy to grasp as other languages, because the language allows you to program in OO instead of trying to force it.


Re: ooperl
by Anonymous Monk on Mar 05, 2000 at 21:07 UTC
    Uhhhhh, after I have read the Object Oriented Perl book, I wish that there is some UML modeler that will let me customize the perl OO code generation.. huhu anyway, my evil perl code is hard to read whether I use the normal or OO style coding, for me, I will need some modeler + good source code documentation + good OO design skill along with the OO Perl skill.. all together to ease my perl life :)) Studying/Exploring/Developing/Finding those tools might be the next step that will highlight the usefulness of studying OO Perl. In the opposite way, if I can find a good perl development tools that will help me with the source code documentation, it may drag my interesting away from OO Perl (e.g like having Siemen 's EasyCODE for hu) Infer: knowing OO Perl is not the last thing that I have to study for my perl life :D *uh, what if LabVIEW or IFAD VDM++ can generate OO Perl code!*
Re: ooperl
by damian1301 (Curate) on Dec 02, 2000 at 11:14 UTC
    Perls OO is soooo easy because first of all pod always explains whats going on and plus we have such a huge archive over at cpan.

    Wanna be perl hacker.
    Dave AKA damian

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://4800]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2022-12-04 05:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found