Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Or lack direct applicability as we still didn't select a default OO style (minus - it's not helpful if a trivial one-line pattern requires 20 lines of interface glue to cope with both blessed hashes and blessed scalars).

What are you thinking of here? OO code in Perl shouldn't care whether an object is a blessed hash, a blessed scalar, a blessed nuisance, inside-out, upside-down, a Moose, a Mouse, or even a C pointer with a thin XS wrapper. You have an opaque reference. You call methods on it without worrying what it points to.

The only case I can immediately think of where this can legitimately fall down is when you inherit from someone else's object in a way that involves you trying to store additional private data inside their blessed data structure. But there are well-known ways to avoid that. And considering that code reuse through inheritance is a dodgy thing in the first place, the dodginess factor goes through the roof when you don't even control the code you're reusing!

Maybe there are other cases where well-written code can go wrong, but all I can say is that I've never yet encountered any problems in Perl that I could attribute to the lack of a single official method of implementing objects. I may well be missing something, but this seems to me to be one of those things that is more about Perl being conceptually messy, than about that messiness causing real problems in practice.

In reply to Re^4: Questions from "Coders at Work" by Porculus
in thread Questions from "Coders at Work" by bsb

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?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2023-03-27 20:18 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (65 votes). Check out past polls.