|
|
| go ahead... be a heretic | |
| PerlMonks |
Re: Private methodsby adrianh (Chancellor) |
| on Mar 09, 2003 at 22:45 UTC ( #241617=note: print w/ replies, xml ) | Need Help?? |
|
If you want to create a subroutine that only the Foo package can access, lexically scoped coderefs are the way to go. However, I can only think of a few situations where you really need to be that secretive. I find that most of the time all I need is to prevent a subclass overriding the subroutine, in which case I would either calling it as a subroutine rather than a method, or specify the package of the method directly. For example:
or
gives us
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||