in reply to OO - problem with inheritance
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!"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: OO - problem with inheritance
by uwevoelker (Pilgrim) on Jan 14, 2002 at 20:47 UTC | |
by frag (Hermit) on Jan 14, 2002 at 21:43 UTC | |
by uwevoelker (Pilgrim) on Jan 14, 2002 at 21:56 UTC | |
by IlyaM (Parson) on Jan 14, 2002 at 22:08 UTC | |
by uwevoelker (Pilgrim) on Jan 14, 2002 at 22:14 UTC | |
|