Why is something that can be called as a sub rather than a method not OO in any meaningful way? Subs are not attached to a data structure. Subs don't support inheritance. Subs don't support polymorphism (aka "late binding").

Yes, of course. I'm not confused on the definitions, differences, or their uses. I was just pointing out that in this case we clearly have an example of a sub/method "wearing both hats", possible only because of the flexibility of Perl. (as an aside, this convergence is far more likely with constructors, when you instantiate and bind your methods to a particular set of data, as opposed to just random methods -- such is the case with Time::Piece, where contruction happens either via new(), overloaded math operators, gmtime(), or localtime() -- this last two are procedural subs, but underneath they all use a constructor that does double duty as a method or sub: _mktime())

As I said, it's not a particularly good idea -- it just sounded like you were asserting that since there was a second hat involved, the first hat no longer applied. I apologize if that was not the intent of your statement.

Matt


In reply to Re(4): Methods supporting both package and OOP style calls by mojotoad
in thread Methods supporting both package and OOP style calls by jk2addict

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.