in reply to Re: OO - best way to have protected methods
in thread OO - best way to have protected methods

How do these two compare to my solution performance wise? The syntax is nice of course but it looks to me as if there are more method calls involved behind the scenes? Am I right?

(It's been 3 years ago since I last did anything serious, >50 lines, in perl... So I am a bit rusty. Java does that to you, you know ;)
  • Comment on Re^2: OO - best way to have protected methods

Replies are listed 'Best First'.
Re^3: OO - best way to have protected methods
by astroboy (Chaplain) on Aug 18, 2005 at 09:11 UTC
    Well, you'd best benchmark it. If you're calling methods in a tight loop it might be a problem, but if you look at the code - say of Attribute::Protected - you're simply calling one other explict method and one anonymous sub for an attribute that you assign to your methods. That slight penalty is offset by the readability conferred IMHO