Re: data() problems

[email protected] (Graham Barr)
Newsgroups perl.loop
Message-ID <[email protected]>
On Thu, Apr 20, 2000 at 08:02:02AM -0400, Joshua Pritikin wrote:
> On Thu, Apr 20, 2000 at 11:39:07AM +0200, [email protected] wrote:
> Sure, except that it is not easy to determine the correct package from
> inside Event::Watcher::init().
> 
> I don't know how to fix this, but I can add a warning to complain about
> 'data' in the constructor...

I think you are getting confused between private data and public data.

The code that Nick set was for private data in classes that inherit from
a base class. This is to ensure that sub-classes do not destroy
data used by the parent class.

Passing data in the contructor is public data, it is set by the user
and not by a sub-class.

In otherwords there should be two methods. One for the user, say data(),
and one for sub-classes that want to ensure data integrity, say private_data()

Graham.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.