more useful options | |
PerlMonks |
Re: Re: OO - problem with inheritanceby uwevoelker (Pilgrim) |
on Jan 14, 2002 at 20:47 UTC ( [id://138608]=note: print w/replies, xml ) | Need Help?? |
> It sounds like you're wrestling with the question of how to create class data so that the accessors are inherited but not the data itself.
I would like the accessors _and_ data inherit. In base_class is the big $parameter_config hashref. And there is a constructor new() which execlusively deals with this hashref. He gets his values by $parameter_config->{..}{..} and so on. But the other modules, which inherit from base_class only submit their changes to that huge config-hashref. Because this can't be done directly, I wrote two subroutines in base_class: valid_parameter and config_parameter. I want them to store the additional information in this hashref. But - and here is my problem - this hashref should be unique for each datatype/class. So I would like to access the hashref in base_class but the contents should be specific to the calling class. I agree, that this is very naive. Now I'm searching for an other approach. Have you written my reply to Ilya's answer? I would like to use the last method: copy the hash and change it a little bit. But because it's an hashref, I think this won't work... To your suggestion: I need the %parameter_config hash before new() is called, because new() needs this information to figure out, if the parameters given to new() are correct. So I need code I can run when the class is loaded. Thank you, good bye, Uwe
In Section
Seekers of Perl Wisdom
|
|