Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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 lurking in the Monastery: (4)
As of 2015-11-28 13:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (742 votes), past polls