Both examples require more functionality in the code higher up. It's not OO due to insufficient encapsulation.
I don't understand what you mean by "higher up". The code is almost identical to yours, just written directly in Perl, rather than some new and cumbersome operator application language.

I also don't understand what you mean about "insufficient encapsulation". Why is that? If you mean that I shouldn't be calling $_->salary directly than you are arguing circularly as this whole discussion is about whether that's OK or not. If you don't mean that, please tell me what I should have encapsulated but didn't.

As for the "deny by default" strategy, I get it free with Perl already, why do I need to write all that code to get it back again? Plus, allow by default is really easy to implement in "normal" Perl too so it's not like it was urgently in need of simplification. Also, it's a pain now to ignore some but not others and it's still under the control of the called object, not the caller. This may suit a framework (where things kind of become inside-out) but it's not the general case.


In reply to Re^16: Assignable Subroutines by fergal
in thread Assignable Subroutines by dragonchild

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.