in reply to ISA with packages ... A barebones minimal example
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: The Scope Resolution Operator (was Re: ISA with packages ... A barebones minimal example)
by Arunbear (Prior) on Oct 08, 2004 at 22:44 UTC |