in reply to managing constants created with constant.pm
Now all your classes will have the which_consants class method which given a list of constant names returns the names which exist as constants in the given package. As you can see that's simply implemented by looking into the %constants::declared variable, so that's just one approach to the problem.sub UNIVERSAL::which_constants { my($class, @constants) = @_; return grep exists $constant::declared{"$class\::$_"}, @constants; }
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: managing constants created with constant.pm
by antirice (Priest) on Jul 14, 2003 at 11:14 UTC | |
by broquaint (Abbot) on Jul 14, 2003 at 11:25 UTC |