Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl - Is it an OO Language

by Zaxo (Archbishop)
on Aug 26, 2002 at 18:11 UTC ( #192964=note: print w/ replies, xml ) Need Help??


in reply to Perl - Is it an OO Language

Encapsulation is done with closures:

{ my $secret = qr/^word$/; sub guess { $_ = shift || ''; m/$secret/; } }

Polymorphism is done with use overload $op => sub {};, or with overriding functions. There are lots of examples in the link. Both mechanisms respect inheritance.

Don't worry about 'true' OO. That is a chimera cooked up by religionists of various languages to put down other languages. Many take the ability to do something besides OO as disqualifying. OO is a methodology for design and structure. It's not the only one.

Object Oriented Perl by TheDamian is the primary reference book. Perl's perlboot, perltoot, perltooc (AKA perltootc in 5.6 - thanks, demerphq, for pointing that out), perlbot are in the distribution as tutorials, along with perlref, perlobj, perlmod as references.

After Compline,
Zaxo


Comment on Re: Perl - Is it an OO Language
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-12-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (181 votes), past polls