Thanks to the responses and a little digging, I know now enough to re-ask the original question. The real sticking point was this ... "what are the available alternatives to the standard scope resolution operator in perl (aka double-colon)".

Although the suggestions about using OO programming are appreciated, the problem is I have two pre-existing packages "Alpha" and "Bravo" (lets avoid the names A and B) and they are already done and not coded OO-style, they're just filled with run-of the mill subroutines.

With that in mind, I redid the barebones example, I took out all the Exporter stuff, and just used @ISA in tandem with Bravo->SayBye() ... it worked as expected.

The new problem is, that Bravo->SayBye() does not exactly work the same as Bravo::SayBye() because the first one (invisibly?) passes an extra argument, as someone already pointed out.

That's not good because it messes up the expected results of the subroutines.

What it all boils down to is I need to do inheritance but without being able to rewrite "OO style" package code, and without the benefit of having the double-colon scope resolution operator as an option. That's essentially what I was trying to do. Any more suggestions? Do I have to go in and rewrite Alpha and Bravo just to be able to do inheritance?


In reply to The Scope Resolution Operator (was Re: ISA with packages ... A barebones minimal example) by Anonymous Monk
in thread ISA with packages ... A barebones minimal example by Anonymous Monk

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.