Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Can I check if a loop's scope is entered for the first time? (Devel::Callsite)by LanX (Saint) |
on May 06, 2018 at 19:59 UTC ( [id://1214123]=note: print w/replies, xml ) | Need Help?? |
Thanks Damian, but I'm afraid this is not solving my problem, just another one. * From what I see in the sources of Var::Pairs are you binding a cycling iterator to the call place with the help of Devel::Callsite . This is just a more secure way of using line and file from caller . But this will only work well if you always finish the loop without exiting in the middle, since you are only initializing once by the first entry and letting the iteration starting new after a full loop. What I'm looking for is to re-init the iterator when it is re-entered again. Hence to safely use last and return or other loop exits. Consider this example showing that your iterators are not reset after breaking the loop.
updateNB: each has of course the same (and more) limitations.
Cheers Rolf
*) There are different kinds of iterators, please correct me if I'm missing a way to apply this to my kind of iterators ...
In Section
Seekers of Perl Wisdom
|
|