Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Perl_API get_sv and SvIV_set

by salva (Canon)
on Apr 16, 2006 at 19:34 UTC ( [id://543726]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Perl_API get_sv and SvIV_set

you also have to tell perl that the integer on the IV slot is good with SvIOK_on():
SV* super_i; super_i = get_sv("main::buu_test_i", TRUE); SvIV_set(super_i, 42); SvIOK_on(super_i);

Replies are listed 'Best First'.
Re^2: Perl_API get_sv and SvIV_set
by BUU (Prior) on Apr 16, 2006 at 20:58 UTC
    Ah, you are completely correct and it works happily. However I wonder if you could answer another question. I am trying to find an op that gets called at the 'end' of every loop, just before the next iteration begins. Is there any such beast? The B module seems to imply that pp_redo is called, but in my tests it doesn't seem to be. Any ideas?

      It sounds like you are looking for the opcode equivalent of the 'continue' statement. From a casual look at the differences in the output of these two commands:

      perl -MO=Concise -e 'while ($z == 1) { $x=2;} continue {$y=3;}' perl -MO=Concise -e 'while ($z == 1) { $x=2;}'
      I would guess that the opcode is 'pp_next'.

        Well, I modified pp_next by adding a "DIE" call in the middle of it but no loop I tried could trigger it. Doesn't seem to be the one I want.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://543726]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.