Gurusamy Sarathy wrote: > I doubt that change#1307 is the problem--we call sv_mortalcopy() in > lots of other situations. Yes, but not where tied magic is involved. sv_mortalcopy is recursively calling the FETCH method when called on a tied hash/array. This is surely broken? > IIRC, Chip did the work to support self-ties (prompted by Joshua's > reports, maybe). I remember thinking at the time that the patch that > we added might not really support self-referential ties in general > (as opposed a variable tied to itself, in particular). I'm not sure > about the details now, but it may have been something to do with > scenarios like A-tiedto-B-tiedto-C-tiedto...tiedto-A not working. Shouldn't tie magic be disabled when retrieving from the array 'underneath' a tie? Unless this is done, self-ties cannot ever work. If self-ties are deemed to be unsupported, then pp_tie should detect and attemt to do so and croak. That is certainly the easiest option. I'm happy to have a crack at getting them to work correctly, but I'd need someone with a sufficiently pointy hat to make some suggestions as to how to do it. > Whittling it down to a small test case may prove educational. I can't get it any simpler than this: package MyTie; sub TIEARRAY { print ("TIEARRAY @_\n"); bless $_[1], $_[0] } sub FETCH { print ("FETCH @_\n"); return($_[0]->[$_[1]]); } package main; my (@self, @tie); tie(@self, "MyTie", \@self); my $val = $self[0]; Run it and it will recurse like this: TIEARRAY MyTie ARRAY(0x2f508) FETCH MyTie=ARRAY(0x2f508) 0 FETCH MyTie=ARRAY(0x2f508) 0 FETCH MyTie=ARRAY(0x2f508) 0 FETCH MyTie=ARRAY(0x2f508) 0 FETCH MyTie=ARRAY(0x2f508) 0 FETCH MyTie=ARRAY(0x2f508) 0 ... until it core dumps. -- Alan BurlisonThread Previous | Thread Next