From: Nick Ing-Simmons Date: Sat, 2 Sep 2000 16:48:35 +0000 (+0000) Subject: If overloaded %{} etc. return the object do not loop. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aacdac464b116367cebe4e1e19fd4b760789bbdf;p=p5sagit%2Fp5-mst-13.2.git If overloaded %{} etc. return the object do not loop. Thus sub deref { $_[0] } functions if object is wanted type. p4raw-id: //depot/perl@7009 --- diff --git a/pp.h b/pp.h index 7f396b2..029583a 100644 --- a/pp.h +++ b/pp.h @@ -147,7 +147,7 @@ used, guarantees that there is room for at least C to be pushed onto the stack. =for apidoc Am|void|PUSHs|SV* sv -Push an SV onto the stack. The stack must have room for this element. +Push an SV onto the stack. The stack must have room for this element. Does not handle 'set' magic. See C. =for apidoc Am|void|PUSHp|char* str|STRLEN len @@ -185,7 +185,7 @@ Push an integer onto the stack, extending the stack if necessary. Handles 'set' magic. See C. =for apidoc Am|void|XPUSHu|UV uv -Push an unsigned integer onto the stack, extending the stack if necessary. +Push an unsigned integer onto the stack, extending the stack if necessary. See C. =cut @@ -342,10 +342,13 @@ See C. { dTARGETSTACKED; \ { dSP; tryAMAGICunW(meth,FORCE_SETs,shift,RETURN);}}} -#define setAGAIN(ref) sv = arg = ref; \ - if (!SvROK(ref)) \ +#define setAGAIN(ref) sv = ref; \ + if (!SvROK(ref)) \ Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \ - goto am_again; + if (ref != arg && SvRV(ref) != SvRV(arg)) { \ + arg = ref; \ + goto am_again; \ + } #define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0)