in reply to Missing base classes when called from Tk

I tried to study up on our... so I'm sort of fishing in the dark here, but I wonder: are those four packages in the same source file? If so, what if you were to push @ISA, ...; instead of always replacing its contents via "="?

According to the docs for "our":

Multiple "our" declarations in the same lexical scope are allowed if they are in different packages. If they happened to be in the same package, Perl will emit warnings if you have asked for them. use warnings; package Foo; our $bar; # declares $Foo::bar for rest of lexical scope $bar = 20; package Bar; our $bar = 30; # declares $Bar::bar for rest of lexical scope print $bar; # prints 30 our $bar; # emits warning
So maybe you want:
package File_Rating_DB; #pckg ONE sub write_db(){}... package Entry_Ordering; #pckg TWO our @ISA = qw(File_Rating_DB); sub next_rand_or_recorded_file() {}... package Entry_Display_In_Wins; #pckg THREE our @ISA; push @ISA, qw(Entry_Ordering); sub __hk_space(){ call next_rand_or_recorded_file}... sub __hk_quit(){ ...calls write_db on exit } sub handle_key($tkcontext,$dbhandle,$key_event, $key_code) {} package Timed_Display_In_Wins; #pckg FOUR our @ISA; push @ISA, qw(Entry_Display_In_Wins); sub _handle_timer(){}
Update: Then again, if the four packages are in the same file, maybe you only want "our @ISA" once (in package TWO) -- try leaving out the "our @ISA" in the later packages, and just push onto it.

(As I said, I'm just guessing, but it seems worth a try, maybe?)

BTW, regarding my earlier reply, I do know what you mean when you say the old code "wasn't in a form I wanted to enhance it in." I've had that same feeling about some of the stuff I've written, and somehow it usually seems to involve Tk scripts... Good luck!

Replies are listed 'Best First'.
Re^2: Missing base classes when called from Tk
by perl-diddler (Chaplain) on Sep 27, 2007 at 19:16 UTC
    Well....they *are* all in one file. But @ISA should be local to each package's namespace. Not that I'm sure what effect it has (if any), but I also have brackets around each package & its code, ala:
    {package one;....} {package two; @ISA = qw(one); use base qw(one);...} {package three; @ISA = qw(two); use base qw(two);...} {package four; @ISA = qw(three); use base qw(three);...}
    I have other duplicate named, but in different package variables too. I think each @ISA is specific / package -- otherwise how can you walk the symbol table for a package to see if it ISAnother type package?