diff options
author | franck cuny <franck@lumberjaph.net> | 2010-03-04 06:16:07 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-03-04 06:16:07 +0100 |
commit | cda644c83656ca99dd9e24b52fa7cbb6e2f44198 (patch) | |
tree | cc09847cb15c2d57ea18967dd8d5bb5e99bf0837 | |
parent | start to implement private and protected attributes (diff) | |
download | moosex-privacy-cda644c83656ca99dd9e24b52fa7cbb6e2f44198.tar.gz |
add POD about private and protected traits
-rw-r--r-- | lib/MooseX/Privacy.pm | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/MooseX/Privacy.pm b/lib/MooseX/Privacy.pm index 97ee6ac..172cf82 100644 --- a/lib/MooseX/Privacy.pm +++ b/lib/MooseX/Privacy.pm @@ -29,12 +29,6 @@ sub init_meta { ); } -package Moose::Meta::Attribute::Custom::Trait::Private; -sub register_implementation { 'MooseX::Privacy::Trait::Private' } - -package Moose::Meta::Attribute::Custom::Trait::Protected; -sub register_implementation { 'MooseX::Privacy::Trait::Protected' } - 1; __END__ @@ -46,6 +40,18 @@ MooseX::Privacy - Provides the syntax to restrict/control visibility of your met use MooseX::Privacy; + has config => ( + is => 'rw', + isa => 'Some::Config', + traits => [qw/Private/], + ); + + has username => ( + is => 'rw', + isa => 'Str', + traits => [qw/Protected/], + ); + private_method foo => sub { return 23; }; @@ -105,6 +111,16 @@ within the class AND any of it's subclasses. my $bar = Bar->new; $bar->bar; # ok +=head2 Attributes + +=head3 Private + +When the B<Private> traits is applied to an attribute, this attribute can only be read or set within the class. + +=head3 Protected + +When the B<Protected> traits is applied to an attribute, this attribute can only be read or set within the class AND any of his subclasses. + =head1 AUTHOR franck cuny E<lt>franck@lumberjaph.netE<gt> |