develooper Front page | perl.perl5.porters | Postings from December 2014

about commit "[perl #77362] Assigning glob to lvalue causes stringification"

From:
bulk88
Date:
December 29, 2014 21:57
Subject:
about commit "[perl #77362] Assigning glob to lvalue causes stringification"
Message ID:
20141229215714.15560.qmail@lists-nntp.develooper.com
I am currently rewriting Perl_gv_add_by_type but I see something strange 
in the existing code.

http://perl5.git.perl.org/perl.git/commitdiff/13be902cef8b01c085a6b8b1b59fa2754a10cdfb
https://rt.perl.org/Ticket/Display.html?id=77362

So what is the sv_u of a PVLV? Why would a LV have a GP ptr? I thought 
the sv_u of a PVLV was a PV buffer. I have some old XS code to 
de-magic/vivify a hash slice, since otherwise I need to croak.

     if (SvREADONLY(buffer)) {
         croak(PL_no_modify);
     }
     if(SvTYPE(buffer) == SVt_PVLV && LvTYPE(buffer) == 'y'){
         sv_setpv_mg(buffer, " ");
         if(LvTARG(buffer)) buffer = LvTARG(buffer);
     }
     if (SvMAGICAL(buffer)) {
         DumpSV(buffer);
         croak("%s: magic scalar as buffer not supported.", cvname);
     }



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