So, how do I create variables that are visible to subclasses but tell the user not to use them if they know what's good for them?
Well, first of all, (IMO), it's never a good idea to access attributes from other classes (or objects) directly. So the user doesn't need to be told that it's a bad idea for a specific class - it's always a bad idea.

Second, if you want to tell the user something, use POD.

If perl doesn't have a concept of protected variables, then class inheritance becomes pointless, surely.
Well, Perl doesn't even have the concept of object instance variables. Can't really blame Perl not to have a specific flavour of a thing it doesn't have to begin with. Perl's OO is the opposite of the rest of Perl. Most of Perl is about programmer convenience, letting the programmer focus on the important things, and having the language take care of the details. But when it comes to OO, Perl gives the programmer only two things: @ISA and bless. And that's it. Everything else you have to do yourself.

In reply to Re: use fields, underscores and subclasses by JavaFan
in thread use fields, underscores and subclasses by MattLG

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.