That is a separate issue. If you are writing a module that you want to support subclassing of and you have a function that you want to allow to be overridden, then you should probably just make it a method.

But it is perfectly reasonable to write a module that you want to support subclassing of but that uses utility functions that should not be overridden because they are tied to some current implementation detail that you might want to change later without breaking current subclasses.

A separate issue is whether you want subclasses to be able to conveniently call this function. The previous solution accomplishes this but doesn't allow for overriding, which is probably the right solution for some cases.

Perl is a bit strange for a language that supports OO in that it provides no features for separating the details of your module that 1) are implementation details that you want to keep completely to yourself so that you can create a new version that improves some things without breaking other people's code, 2) are suitable for use by a subclass, 3) are suitable to be overridden, 4) are to be used when the module is used.

This, however, does not mean that every single detail of your module should be in (3).

        - tye

In reply to (tye)Re2: $functions xor $methods by tye
in thread $functions xor $methods by Ovid

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.