I think you'll find perltootc - Tom's OO Tutorial for Class Data in Perl very useful, in particular the section Inheritance Concerns. Borrowing code from that, you can use something like this:
package base_class; my %parameter_config = {# the same as before...}; # accessor for class-specific hash named %parameter_config: sub parameter_config { my $obclass = shift; my $class = ref($obclass) || $obclass; my $varname = $class . "::parameter_config"; no strict "refs"; # to access package data symbolically %$varname = {foo=>'bar'}; # this is the package-local hash %parameter_config. # Just refering to '%parameter_config' should refer to # %base_class::parameter_config. }
To initialize the package-specific %parameter_config, throw in similar magic into &base_class::new.
-- Frag.
--
"It's beat time, it's hop time, it's monk time!"
In reply to Re: OO - problem with inheritance
by frag
in thread OO - problem with inheritance
by uwevoelker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |