Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

AFAIK, perl OO consists essentially in 2 (or 3) basic intrinsics and a bunch of usage rules about data structures. So, according to the perl TIMTOWTDI's way of life, you're allowed to do what you want...

Then the following question is: How may I be sure I'm coding what I want?
In this case, I'm sorry to tell that I've no simple answer here: In fact it really depends on what you want.

Practically, the hash data structure is the most genuine to be used as an object (as far as you consider an object as a bag of named properties [aka key/values]).

When you're defining an object, you're implicitly defining a contract which must be followed by everyone whishes derive from your object. This rule defines the interface of your object. Talking about Perl, as object orientation is build as an addon to the language, when devivating you're tied to parent data structure. But talking about objects, heritage is not the only possible relation between objects (quiz: what are the other one?).

Please refer to Perl Design Patterns for more details about perl objects ans the way to associate them.

____
HTH, Dominique
My two favorites:
If the only tool you have is a hammer, you will see every problem as a nail. --Abraham Maslow
Bien faire, et le faire savoir...


In reply to Re: Why is a hash the default "object" in oo perl? by dfaure
in thread Why is a hash the default "object" in oo perl? by theAcolyte

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-16 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found