If I understand your question correctly, you have a situation in which you call $foo->a(), which calls $bar->b(), and in the second call, you want to get $foo. Is that right?
You could, of course, pass $foo as an argument. As you correctly note, doing that "violates one, or more, OO rules & best practice(s)." I think that's also true if you could get this info from caller or some analog. That is, your desire to know this info may reveal a design problem.
You go on to say that maybe this could be a class behavior that you can add to any classes that need it. I agree this is probably a better solution, if this kind of interface is really needed at all. Something as simple as Re: Proper way to create 'globals' might do the trick too.
In reply to Re: A caller() by any other name
by kyle
in thread A caller() by any other name
by Bloodnok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |