Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Answer: How can I create private object variables?

( #582757=categorized answer: print w/ replies, xml ) Need Help??

Q&A > object-oriented programming > How can I create private object variables? contributed by pemungkah

Inside-out classes are another nice way to do this. The data is held in a my (lexical) variable inside the class; all the outside world sees is an anonymous scalar which is blessed into the class. The methods can access the class lexicals (as long as they're defined within scope of the lexicals), but the outside world can't.

See Class::Std and Object::InsideOut for examples.

Comment on Answer: How can I create private object variables?
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-08-01 00:13 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (285 votes), past polls