Re: var watchers restricted?

[email protected] (Graham Barr)
Newsgroups perl.loop
Message-ID <[email protected]>
On Tue, Feb 08, 2000 at 10:37:43AM -0500, Joshua Pritikin wrote:
> On Tue, Feb 08, 2000 at 04:21:01PM +0100, [email protected] wrote:
> > are there limitations in the type of variables or accesses var watchers
> > can check?
> 
> In a word, yes.
> 
> > I tried to watch the deletion of a hash element. This did not work
> > regardless if I watched the complete hash or the element itself.
> 
> I think it might work in the latest dev snapshot.

Really ?
 
> > If I watch a complete hash, element modifications are not recognized.
> 
> Correct.

The is because you are modifying the SV held in that element. Perl does
not consider this a modification to the hash itself.
 
> > If I watch an array element, assignments are recognized, but if I assign
> > via push(), this is ignored.
> 
> Hm.

Likewise you are watching the SV which is at the point at that given time.
push modifies the array, not the element. Likewise I would expect
emptiny the array then modifyint the element in the array will not
be noticed either.
 
> > If I watch an array completely, Event reports an exception if I access
> > the array by push(). This case is activated in the attached hack.
> 
> It sounds like I need to add a filter to restrict var watchers to plain
> vanilla scalars.  Do you need more flexibility than that?

The original watcher code that I had was only designed with scalars in
mind.

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.