Excuse my ignorance as I am still very green on perlguts, but my thinking was that you could look at the ops before and after the call to see if you were called between and op_enterloop and op_leaveloop.
I had run this by the author of Want.pm and he suggested something like the want_boolean
function in Want.xs, but to look for OP_AND and it also
needs to check that (o->op_next->op_type == OP_LEAVELOOP).
I still think that in theory this take seems more correct.
-Lee
"To be civilized is to deny one's nature." | [reply] |
Dancing through the optree for this information's a tricky thing, as a fair amount of information may be lost by the time we look for context. I was also thinking more in terms of syntactic clues--how can the parser look at the source and determine that something should be an iterator or not? If we can't tell syntactically, then it's likely not safe to be doing.
| [reply] |