package Module::Monkey; use base 'Module'; BEGIN { Module->import(); }
Note that use base does NOT call import() on the superclass.
You're trying to use Module as a base class, and as a holder of constants to be exported, and as a "module loader" that loads all its subclasses. Life would be a lot simpler if you would drop at least one of these functions in another module, and I would recommend splitting them all out, which will make your code a lot saner:
# in Module/Loader.pm package Module::Loader; use Module; use Module::Monkey; use Module::Ape; use Module::Constants; # in Module.pm package Module; use Module::Constants; sub some_inhereted_sub { }; # in Module/Constants.pm; package Module::Constants; use constant { MDB_INT => 0, MDB_FLOAT => 1, MDB_STRING => 2, }; # in Module/Ape; package Module::Ape; use Module::Constants; use base Module;
Etc.
Hope this helps,
Joost.
In reply to Re: Problems importing constants in multiple namespaces
by Joost
in thread Problems importing constants in multiple namespaces
by Weevil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |