diff options
author | franck cuny <franck@lumberjaph.net> | 2010-04-29 09:02:27 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-04-29 09:02:27 +0200 |
commit | ea4a890234668decd6e4f3efc9c22c333176810e (patch) | |
tree | 84c9f1d20fab29b0ed9096a5504a47b59fc73a0d | |
parent | remove dwimmery (diff) | |
download | moosex-privacy-ea4a890234668decd6e4f3efc9c22c333176810e.tar.gz |
POD cleaning
-rw-r--r-- | lib/MooseX/Privacy.pm | 42 | ||||
-rw-r--r-- | lib/MooseX/Privacy/Meta/Attribute/Private.pm | 1 | ||||
-rw-r--r-- | lib/MooseX/Privacy/Meta/Attribute/Protected.pm | 1 | ||||
-rw-r--r-- | lib/MooseX/Privacy/Meta/Class.pm | 68 | ||||
-rw-r--r-- | lib/MooseX/Privacy/Meta/Class/Role.pm | 28 |
5 files changed, 88 insertions, 52 deletions
diff --git a/lib/MooseX/Privacy.pm b/lib/MooseX/Privacy.pm index 172cf82..b41afc4 100644 --- a/lib/MooseX/Privacy.pm +++ b/lib/MooseX/Privacy.pm @@ -38,27 +38,27 @@ MooseX::Privacy - Provides the syntax to restrict/control visibility of your met =head1 SYNOPSIS - use MooseX::Privacy; + use MooseX::Privacy; - has config => ( - is => 'rw', - isa => 'Some::Config', - traits => [qw/Private/], - ); + has config => ( + is => 'rw', + isa => 'Some::Config', + traits => [qw/Private/], + ); - has username => ( - is => 'rw', - isa => 'Str', - traits => [qw/Protected/], - ); + has username => ( + is => 'rw', + isa => 'Str', + traits => [qw/Protected/], + ); - private_method foo => sub { - return 23; - }; + private_method foo => sub { + return 23; + }; - protected_method bar => sub { - return 42; - }; + protected_method bar => sub { + return 42; + }; =head1 DESCRIPTION @@ -82,8 +82,8 @@ When you declare a method as B<private>, this method can be called only within t 1; my $foo = Foo->new; - $foo->foo; # die - $foo->mul_by_foo; # ok + $foo->foo; # die + $foo->mul_by_foo; # ok =head2 Protected @@ -107,9 +107,9 @@ within the class AND any of it's subclasses. 1; my $foo = Foo->new; - $foo->foo; # die + $foo->foo; # die my $bar = Bar->new; - $bar->bar; # ok + $bar->bar; # ok =head2 Attributes diff --git a/lib/MooseX/Privacy/Meta/Attribute/Private.pm b/lib/MooseX/Privacy/Meta/Attribute/Private.pm index 9e5bc70..241c6fb 100644 --- a/lib/MooseX/Privacy/Meta/Attribute/Private.pm +++ b/lib/MooseX/Privacy/Meta/Attribute/Private.pm @@ -2,7 +2,6 @@ package MooseX::Privacy::Meta::Attribute::Private; use Moose::Role; use Carp qw/confess/; -use MooseX::Types::Moose qw/Str ArrayRef/; sub _generate_accessor_method { my $self = shift; diff --git a/lib/MooseX/Privacy/Meta/Attribute/Protected.pm b/lib/MooseX/Privacy/Meta/Attribute/Protected.pm index 063a2c0..05af63b 100644 --- a/lib/MooseX/Privacy/Meta/Attribute/Protected.pm +++ b/lib/MooseX/Privacy/Meta/Attribute/Protected.pm @@ -2,7 +2,6 @@ package MooseX::Privacy::Meta::Attribute::Protected; use Moose::Role; use Carp qw/confess/; -use MooseX::Types::Moose qw/Str ArrayRef/; sub _generate_accessor_method { my $self = shift; diff --git a/lib/MooseX/Privacy/Meta/Class.pm b/lib/MooseX/Privacy/Meta/Class.pm index 0361035..554752c 100644 --- a/lib/MooseX/Privacy/Meta/Class.pm +++ b/lib/MooseX/Privacy/Meta/Class.pm @@ -3,7 +3,7 @@ package MooseX::Privacy::Meta::Class; use Moose::Role; use Moose::Meta::Class; -with ( +with( 'MooseX::Privacy::Meta::Class::Role' => { name => 'protected' }, 'MooseX::Privacy::Meta::Class::Role' => { name => 'private' }, ); @@ -14,16 +14,78 @@ sub register_implementation {'MooseX::Privacy::Trait::Private'} package Moose::Meta::Attribute::Custom::Trait::Protected; sub register_implementation {'MooseX::Privacy::Trait::Protected'} - 1; + __END__ =head1 NAME -MooseXMooseX::Privacy::Meta::Class +MooseXMooseX::Privacy::Meta::Class - Meta Class for your privacy =head1 SYNOPSIS +=head1 DESCRIPTION + +=head1 METHODS + +=head2 local_private_attributes + +Arrayref of all private attributes + + my $private_attributes = $self->meta->local_private_attributes; + +=head2 local_private_methods + +Arrayref of all private methods + + my $private_methods = $self->meta->local_private_methods; + +=head2 add_private_method + +Add a private method to your object. + + $object->meta->add_private_method('foo', sub { return 23 }); + +or + + $object->meta->add_private_method( + 'foo', + MooseX::Privacy::Meta::Method::Private->wrap( + name => 'foo', + package_name => 'Foo', + body => sub { return 23 } + ) + ); + +=head2 local_protected_attributes + +Arrayref of all protected attributes + + my $protected_attributes = $self->meta->local_protected_attributes; + +=head2 local_protected_methods + +Arrayref of all protected methods + + my $private_methods = $self->meta->local_protected_methods; + +=head2 add_protected_method + +Add a protected method to your object. + + $object->meta->add_protected_method('foo', sub { return 23 }); + +or + + $object->meta->add_protected_method( + 'foo', + MooseX::Privacy::Meta::Method::Protected->wrap( + name => 'foo', + package_name => 'Foo', + body => sub { return 23 } + ) + ); + =head1 AUTHOR franck cuny E<lt>franck@lumberjaph.netE<gt> diff --git a/lib/MooseX/Privacy/Meta/Class/Role.pm b/lib/MooseX/Privacy/Meta/Class/Role.pm index f9de91e..cb7e03a 100644 --- a/lib/MooseX/Privacy/Meta/Class/Role.pm +++ b/lib/MooseX/Privacy/Meta/Class/Role.pm @@ -4,6 +4,7 @@ use MooseX::Role::Parameterized; use Scalar::Util; use Carp qw/confess/; use MooseX::Types::Moose qw/Str ArrayRef/; + use MooseX::Privacy::Meta::Method::Protected; use MooseX::Privacy::Meta::Method::Private; @@ -63,35 +64,10 @@ __END__ =head1 NAME -MooseX::Privacy::Meta::Class::Role +MooseX::Privacy::Meta::Class::Role - Private and Protected parameterized roles =head1 SYNOPSIS -=head1 METHODS - -=head2 local_private_attributes - -Arrayref of all private attributes - - my $private_attributes = $self->meta->local_private_attributes; - -=head2 local_private_methods - -Arrayref of all private methods - - my $private_methods = $self->meta->local_private_methods; - -=head2 add_private_method - -Add a private method to your object. - - $object->meta->add_private_method('foo', sub { return 23 }); - -or - - $object->meta->add_private_method('foo', MooseX::Privacy::Meta::Method::Priva -te->wrap(name => 'foo', package_name => 'Foo', body => sub {return 23}); - =head1 AUTHOR franck cuny E<lt>franck@lumberjaph.netE<gt> |