in reply to Determine if sub is called from control block.

I'm not sure if I understood your problem correctly; maybe the built-in function caller might help you to find out where you came from.

Just have a look at perldoc -f caller

  • Comment on Re: Determine if sub is called from control block.

Replies are listed 'Best First'.
Re: Re: Determine if sub is called from control block.
by shotgunefx (Parson) on Feb 27, 2002 at 10:06 UTC
    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.

    -Lee

    "To be civilized is to deny one's nature."