NAME
MooseX::PrivateSetters::Role::Attribute - Names setters as such, and makes them private
SYNOPSIS
Moose::Util::MetaRole::apply_metaclass_roles
( for_class => $p{for_class},
attribute_metaclass_roles =>
['MooseX::PrivateSetters::Role::Attribute'],
);
DESCRIPTION
This role applies a method modifier to the _process_options()
method, and tweaks the writer parameters so that they are private with an explicit 'set'. Getters are left unchanged. This role copes with attributes intended to be private (ie, starts with an underscore), with no double-underscore in the setter.
For example:
| Code | Reader | Writer |
|--------------------------+--------+------------|
| has 'baz' => (is 'rw'); | baz() | _set_baz() |
| has 'baz' => (is 'ro'); | baz() | |
| has '_baz' => (is 'rw'); | _baz() | _set_baz() |
AUTHOR
brian greenfield, <briang@cpan.org>
COPYRIGHT & LICENSE
Copyright 2010 brian greenfield
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.