defined and exported in one module to a lower level module
You should be aware that the notion of "lower level" doesn't matter for this kind of thing. While there is a hierarchy of namespaces, Perl doesn't automatically do anything with it. Nothing is exported to lower levels by default. Likewise, lower levels do not inherit methods from upper levels. The hierarchy is entirely a convenience for users.
As Joost said, you have to "use" the module at the lower level for it to work. Likewise, for object oriented programming, you have to "use base" or otherwise set the @ISA array.
package My::Class; sub foo { print "Foo" } 1;
package My::Class::Reversed; use base qw( My::Class ); sub foo { print reverse "Foo" } 1;
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re: Can't import constants in multiple namespaces
by xdg
in thread Can't import constants in multiple namespaces
by mje
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |