On Mon, Mar 28, 2011 at 6:22 AM, Stevan Little < stevan.lit...@iinteractive.com> wrote:
> > On Mar 28, 2011, at 8:28 AM, Peter Gordon wrote: > > > I have a small class, where I would like the variables to be read only > > by external calls, but rw for internal access. > > has 'foo' => ( is => 'ro', writer => '_set_foo', ... ); > > Is the more common method for this. On a related note, I actually found myself using that construction frequently enough that I finally put together an attribute trait to take "is => 'rwp'" (read-write-private) which then sets "is => 'ro', writer => '_$name'". It's on the CPAN at MooseX::AttributeShortcuts... The next version is likely to be parameterizable, so '_set_$name' could be the generated writer name. -Chris -- Chris Weyl Ex astris scientia