Subject: | Tie::Watch::{Array,Hash}::Clear is broken (sets shadow object to undef, instead of clearing the array|hash) |
package Tie::Watch::Array;
...
sub Clear {$_[0]->{-ptr} = ()}
This does not clear the array in -ptr but sets -ptr to undef.
It must be
sub Clear { @{ $_[0]->{-ptr} } = () }
same with Tie::Watch::Hash::Clear, it must be
sub Clear { %{ $_[0]->{-ptr} } = () }
This croaks with 1.0 if one clears an array and later tries to access
it, because $_[0]->{-ptr} is no longer an array-ref (but undef) and
cannot be dereferenced.
Looking at the code of 1.2 the Bug seems to be still there, so I assume
its there and in 1.1 too.