Perl: the Markov chain saw | |
PerlMonks |
Re: Re: OO: sharing data across inheritanceby skillet-thief (Friar) |
on Jun 02, 2004 at 11:55 UTC ( [id://359368]=note: print w/replies, xml ) | Need Help?? |
Can you describe the problem that you're trying to solve with Parent and Child? There may be another way of attacking the problem. I am starting to think that "another way" might be in order here. Here is basically what I am trying to do: I am writing an LWP interface to an automated web publishing system. My interface already works, but is written as subroutines to which you have to pass lots of variables each time. Since my scripts are intended to be used by others, I wanted to clean them up and avoid passing around the same variables all the time. That is why I decided to do an OO rewrite. More specifically: There is a certain amount of information that goes with the website to which the user publishes: passwords, directories, etc. Inside that site, there is a series of "journal issues" that have their own specific information, but they of course share the information pertaining to the site. The relationship between Parent and Child in my original post was intended to describe these two different levels. I was thinking of the kind of relationship that exists, in DBI.pm, for example, between the database handle ($dbh) and the individual query objects ($sth). So you are right about state. My Parent class is indeed intended to maintain state, while the Child class was supposed to actually do the real work. Does this mean that I should abandon an OO approach, or just quit trying inheritance? Should my state data just be a class variable? s-t
In Section
Seekers of Perl Wisdom
|
|