"Randy J. Ray" wrote:

> I can't say for certain why the pure-perl implementation doesn't exhibit
> the problem, but I had the same problem at an XS level when I started work
> on the Perl-RPM bindings. In that case, I'm using a self-tied hash, but the
> basis is identical.

I think it perhaps twiddles the mg_flags to stop it recursively calling
FETCH, but I'm dammned if I can figure out how I make it do the same. 
I've reread pp_tie and sv_magic over and over and I can't spot the
trick.

> In my self-tied classes, I disable the tie magic before a fetch or store, then
> reinstate it afterwards. I use simple cpp macros to do this. I don't think it
> threatens empty-subclassing, since I don't affect the @ISA hierarchy or
> anything else. Since the tie magic is very specific, I took the liberty/risk
> of this approach. A sameple of the code I use:
> 
>         #define hv_fetch_nomg(SVP, h, k, kl, f) \
>                 SvMAGICAL_off((SV *)(h)); \
>                 (SVP) = hv_fetch((h), (k), (kl), (f)); \
>                 SvMAGICAL_on((SV *)(h))
> 
> Turning the magic off doesn't clear that part of the underlying structure, so
> "switching" it back on has worked thus far.

Unfortunately I can't do this as I can't predict when a store/fetch is
going to happen.  I need perl to figure out that it has a self tie and
suppress the recursive calls to FETCH.  I know it can be done, but I
can't figure out how!

Thanks anyway,

-- 
Alan Burlison

Reply via email to