Thank for the suggestion, but caller doesnt' provide the context info I need. I'm already using it for the code in question. I'm basically trying to find out wether it's being called in a loop construct or not. (The code keeps track of it's own state info without any OO stuff or direction from the user.)
I've re-written it to use Filter::Simple to change any calls that are not part of a while/for/foreach to use a different version that doesn't retain state. I'll be posting it soon.