summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MooseX/Privacy/Meta/Class/Private.pm29
-rw-r--r--lib/MooseX/Privacy/Meta/Class/Protected.pm28
2 files changed, 57 insertions, 0 deletions
diff --git a/lib/MooseX/Privacy/Meta/Class/Private.pm b/lib/MooseX/Privacy/Meta/Class/Private.pm
index d63757c..c0907fa 100644
--- a/lib/MooseX/Privacy/Meta/Class/Private.pm
+++ b/lib/MooseX/Privacy/Meta/Class/Private.pm
@@ -16,6 +16,16 @@ has local_private_methods => (
     handles    => { '_push_private_method' => 'push' },
 );
 
+has local_private_attributes => (
+    traits     => ['Array'],
+    is         => 'ro',
+    isa        => ArrayRef [Str],
+    required   => 1,
+    default    => sub { [] },
+    auto_deref => 1,
+    handles    => { '_push_private_attribute' => 'push' },
+);
+
 sub add_private_method {
     my ( $self, $method_name, $method ) = @_;
 
@@ -36,6 +46,7 @@ sub add_private_method {
 }
 
 1;
+
 __END__
 
 =head1 NAME
@@ -46,10 +57,28 @@ MooseX::Privacy::Meta::Class::Private
 
 =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});
+
 =head1 AUTHOR
 
 franck cuny E<lt>franck@lumberjaph.netE<gt>
diff --git a/lib/MooseX/Privacy/Meta/Class/Protected.pm b/lib/MooseX/Privacy/Meta/Class/Protected.pm
index f7b72ee..cdd980e 100644
--- a/lib/MooseX/Privacy/Meta/Class/Protected.pm
+++ b/lib/MooseX/Privacy/Meta/Class/Protected.pm
@@ -16,6 +16,16 @@ has local_protected_methods => (
     handles    => { '_push_protected_method' => 'push' },
 );
 
+has local_protected_attributes => (
+    traits     => ['Array'],
+    is         => 'ro',
+    isa        => ArrayRef [Str],
+    required   => 1,
+    default    => sub { [] },
+    auto_deref => 1,
+    handles    => { '_push_protected_attribute' => 'push' },
+);
+
 sub add_protected_method {
     my ( $self, $method_name, $method ) = @_;
 
@@ -47,10 +57,28 @@ MooseX::Privacy::Meta::Class::Protected
 
 =head1 METHODS
 
+=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 $protected_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>