> I basically copied the logic from pp_tie.  However, when the FETCH
> method (written in perl) is called, it goes into a recursive frenzy
> repeatedly calling itself on the AV.  This kind of makes sense - after
> all because it is a self-tie the tied from and tied to AVs are one and
> the same.  However this recursion doesn't happen if you do a self-tie
> purely in perl, so I must be missing a necessary step somewhere.  Can
> someone give me a clue?

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.

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.

Randy
-- 
[EMAIL PROTECTED]            Linux: Because rebooting is for adding new hardware.

Any spammers auto-extracting addresses from this message will definitely want
to include [EMAIL PROTECTED] and [EMAIL PROTECTED]

Reply via email to