Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Perl_API get_sv and SvIV_set

by BUU (Prior)
on Apr 17, 2006 at 00:58 UTC ( #543735=note: print w/replies, xml ) Need Help??


in reply to Re: Perl_API get_sv and SvIV_set
in thread Perl_API get_sv and SvIV_set

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?

Replies are listed 'Best First'.
Re^3: Perl_API get_sv and SvIV_set
by Util (Priest) on Apr 17, 2006 at 02:10 UTC

    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.

        There is no such op. If you add a continue block, you'll notice that lineseq has three arguments/statements instead of just two. If you want to run something at the end of every loop, alter the optree to wire your op in.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://543735]
help
Chatterbox?
[Discipulus]: 2 weekends ago LanX
[Lotus1]: cb is nsfw this morning
[Lotus1]: I wonder if ascii art would work in the cb....
[jedikaiti]: lolol
Tux looks up his status to find being an Abbot
[choroba]: pm-cb-g now shows the number of unread messages, commit on its way to github
[Tux]: choroba any plans for highlight patterns?
[choroba]: Tux feel free to submit a pull request :-)
[choroba]: I like the idea, but currently I only have time for small changes
[choroba]: but it should be a bit better in two weeks

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2017-09-20 16:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?