I would like some attributes (perhaps this is the wrong term in this context) to be private, that is, only internal for the object use – can’t be read or written from the outside.
For example, think of some internal variable that counts the number of times any of a set of methods was called.
Where and how should I define such a variable?
The
Moose::Manual::Attributesshows the following way to create private attributes:Setting
init_argmeans this attribute cannot be set at the constructor. Make it arwor addwriterif you need to update it./I3az/