> How often do you actually end up wanting to add methods to something that started as a plain old datastructure?

When it happens and you need to refactor the code, it's a real pain in the @$$ ...

I think you don't see this situation, because you already incorporated all the ugly workarounds necessary.

> I think you invent a convoluted solution to a convoluted example.

Nope, actually I am spending lot's of time planing in advance to avoid this situation. (And I don't think I'm alone)

Other can just calmly start to code and easily react afterwards. That's one of the big advantages of OOP.

> Get it by tied(@array) and call whatever you need on that.

OK so I can extend the tied package with methods intead of creating a new one... well certainly an improvement. Thx! 8)

But do you really consider writing something like this

 tied(@employees)->list_actives()

to be more readable than

 \@employees->list_actives()

or even

 $employees_ar->list_actives()

???

Cheers Rolf


In reply to Re^2: Benefits of everything is an object? Or new sigils? by LanX
in thread Benefits of everything is an object? Or new sigils? by LanX

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.