Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can I create private object variables?

by ton (Friar)
on Apr 04, 2001 at 20:06 UTC ( [id://69869]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How can I create private object variables?

... but you usually don't need to. Since your source code is almost always accessible to the caller, s/he can easily modify it to read your members if s/he is determined. I prefer the more perl-y approach of indicating which variables are private via naming conventions (most people use a beginning underscore for private variables). This lets the user know that you make no guarentees about the existance of the member; e.g. the caller can access it if s/he wants to, but it might not be there in the next version. If their reliance on the existance of that member breaks their code later on, then it's their damn fault for accessing data that was not meant to be accessed. :)

My $0.02

Originally posted as a Categorized Answer.

  • Comment on Re: How can I create private object variables?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://69869]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.