Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
•Re: REALLY Private Methods in perl: Is Perl Flexible enough to be made Inflexible?by merlyn (Sage) |
on Sep 23, 2002 at 14:09 UTC ( [id://200099]=note: print w/replies, xml ) | Need Help?? |
Yes. There are quite a few variations of "privateness" documented in theDamian's excellent Object Oriented Perl. You can check the file and line number of caller, for example.
However, the moment you do that, I would not want to maintain your code. Every attempt I've seen at privacy has made the code more unmaintainable. Just name your "private" methods with a leading underscore, and put "do not call outside of this class" in a comment. People will get the idea, and they deserve what they get when they violate it. Why is that so hard to understand? -- Randal L. Schwartz, Perl hacker
In Section
Seekers of Perl Wisdom
|
|