Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: is it possible to access eval() counter?

by hv (Parson)
on Jun 30, 2006 at 11:48 UTC ( #558557=note: print w/ replies, xml ) Need Help??


in reply to is it possible to access eval() counter?

Here is a simpler approach, if you can use Inline::C:

#!/usr/bin/perl -w use strict; use Inline C => q{ int evalseq() { return PL_evalseq; }}; for (1 .. 10) { eval q{ print "in eval (", evalseq(), ")\n" }; print "outside eval (", evalseq(), ")\n"; }

Of course this delves into undocumented internals, so no guarantee that it will work with every past and future version of perl. (It may also need a pTHX or something for threaded builds, but I don't have one handy to check.)

Hugo


Comment on Re: is it possible to access eval() counter?
Download Code
Re^2: is it possible to access eval() counter?
by Anonymous Monk on Jun 30, 2006 at 14:19 UTC
    Thanks hv :) it works :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://558557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (15)
As of 2015-07-06 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (82 votes), past polls