develooper Front page | perl.perl5.porters | Postings from October 2000

Did change 1307 (GSAR) break self ties?

Thread Previous | Thread Next
From:
Alan Burlison
Date:
October 1, 2000 08:58
Subject:
Did change 1307 (GSAR) break self ties?
Message ID:
39D75F0C.FCEA0B27@uk.sun.com
I think I've managed to track down where self-ties are broken.  It is in
pp_hot.c in pp_aelem, 4 lines from the bottom of the function:

    if (!lval && SvGMAGICAL(sv))        /* see note in pp_helem() */
        sv = sv_mortalcopy(sv);

This was added I believe as part of change 1307, to get local to work on
tied hashes.  However, in the case of self-ties it doesn't work, as the
call to sv_mortalcopy then calls mg_get, which then recurses into
pp_aelem with inevitable consequences.  I've tried temporarily removing
the call to sv_mortalcopy, but that still doesn't fix the problem,
although I'm not quite sure why.  I'm assuming the correct fix is to
disable magic for the tied array for the duration of the call to
sv_mortalcopy, but the save_magic and restore_magic functions are local
to mg.c.  I'm a bit wary of promoting them to be global, as they should
probably be renamed (mg_save/mg_restore?) which involves changing
embed.pl

I'd like some help and advice from someone please - Gurusamay, as your
name is against the changes in this area (761, 802 and 1307) could you
advise?  I know it is a long time ago, but you probably have a far
better idea than I do of the correct fix.

Thanks,

-- 
Alan Burlison

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About