in reply to Multiple Package in one file with equal named variables

The verb my defines lexical scope, and the variables live in pad space. The second point is that inheritance only works for method calls, not access to variables.

If you provide accessor/mutator functions to get at your variables, inheritance will work, and you will have much cleaner code.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Replies are listed 'Best First'.
Re^2: Multiple Package in one file with equal named variables
by Brutha (Friar) on Jan 27, 2006 at 10:20 UTC
    If you provide accessor/mutator functions to get at your variables, inheritance will work
    That would mean the function-with-local-variable solution. Aren't local variables initialized each time the sub is called?

    I forgot to mention that this list is private and constant class data, which is only used in its package. They are used for steering access to a different combination of database tables for each specialized class. That db design is not my work, but I have to live with it.

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)