in reply to Interesting OO/package conundrum...
package Base; my %_required = ('Foo' => {one =>1, two => 1, three =>1}, 'Bar' => {one =>1, three => 1, fourteen =>1}); sub isRequired { my ($self, $attr) = @_; my $class = ref $self; return exists $_required{$class}->{$attr}; }
This way, you will store the hash of the required attributes only once.
Greetings, pike
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Interesting OO/package conundrum...
by dragonchild (Archbishop) on Oct 12, 2001 at 16:49 UTC |