in reply to Any way to inherit constants?

The problem is that Foo::Base is not importing the constant subs from Foo::Constants. You can say

package Foo::Base; use Foo::Constants qw/PI FOO QUUX/;
listing each constant function you want to import, or dress up Foo::Constants with Exporter to define exports and tags for them.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Any way to inherit constants?
by Anonymous Monk on May 15, 2005 at 05:29 UTC

    Whoops, I forgot what I actually have written. Foo::Constants should have looked like this:

    # Foo/Constants.pm package Foo::Constants; use base "Exporter"; use constant PI => 3; our @EXPORT = (PI);
    As such, I can use PI fron within any package that does "use Foo:Constants", but not from any of its subclasses. Thanks!
      agreed! this is the way the problem can be solved the perlish way.
      language is a virus from outer space.