in reply to Re^4: Private and Protected class methods (caller)
in thread Private and Protected class methods

I'd think you'd want to know that whoever is calling the _protected_method() ->can( "_protected_method" )

That's correct, and actually -- it works. The level for caller took some playing with, but caller(1) turns out to be right: caller(0) would be the _protected_sub itself, while caller(1) is whomever called the _protected_sub.

I'd name this method _PROTECTED()

Good point, noted.

In particular, consider a case where I've "exported" a sub into my method namespace.

Hm, interesting. I hadn't considered what would happen when exporting methods like that, since I've never had need to do things like that. I will have to bring it up with my design team and see what to do about it. That particular case seems to work (though I don't entirely understand why), but I can see where more complicated cases in the same class might cause problems.

Thank you, and ++;

<radiant.matrix>
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet