in reply to How to include a large number of constants?
As for your second question, you could have all your constants have a common prefix, like C_. Then, you can do a little introspection as so:
package Constants; use base 'Exporter'; our @EXPORT = grep { substr( $_, 0, 2 ) eq 'C_' && __PACKAGE__->can( $_ ); } keys %Constants::; use constant C_FOO => 1; use constant C_BAR => 2; use constant C_BAZ => 3;
The Perfect is the Enemy of the Good.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to include a large number of constants?
by 5mi11er (Deacon) on Apr 27, 2005 at 17:55 UTC | |
|
Re^2: How to include a large number of constants?
by doom (Deacon) on May 03, 2005 at 03:52 UTC |