summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-02-14 17:59:23 +0100
committerfranck cuny <franck@lumberjaph.net>2010-02-14 17:59:23 +0100
commit2420f34d69fd23289453f0a9db013877a5a0a64b (patch)
tree26a777891e1dc63678417d8918d24a6da2a21dec
parentrequire scalar::util (diff)
downloadmoosex-privacy-2420f34d69fd23289453f0a9db013877a5a0a64b.tar.gz
clean POD
-rw-r--r--lib/MooseX/Privacy.pm35
1 files changed, 23 insertions, 12 deletions
diff --git a/lib/MooseX/Privacy.pm b/lib/MooseX/Privacy.pm
index ad4f907..51485b3 100644
--- a/lib/MooseX/Privacy.pm
+++ b/lib/MooseX/Privacy.pm
@@ -9,12 +9,12 @@ Moose::Exporter->setup_import_methods(
 
 sub private_method {
     my ( $meta, $name, $body ) = @_;
-    $meta->add_private_method( $name, $body );
+    $meta->add_private_method($name, $body);
 }
 
 sub protected_method {
     my ( $meta, $name, $body ) = @_;
-    $meta->add_protected_method( $name, $body );
+    $meta->add_protected_method($name, $body);
 }
 
 sub init_meta {
@@ -40,11 +40,11 @@ MooseX::Privacy - Provides the syntax to restrict/control visibility of your met
 
   use MooseX::Privacy;
 
-  private _foo => sub {
+  private_method foo => sub {
     return 23;
   };
 
-  protected _bar => sub {
+  protected_method bar => sub {
     return 42;
   };
 
@@ -52,20 +52,26 @@ MooseX::Privacy - Provides the syntax to restrict/control visibility of your met
 
 MooseX::Privacy brings the concept of private and protected methods to your class.
 
+=head1 METHODS
+
 =head2 Private
 
 When you declare a method as B<private>, this method can be called only within the class.
 
     package Foo;
+
     use Moose;
     use MooseX::Privacy;
-    private _foo => sub { return 23 };
-    sub foo { my $self = shift; $self->_foo }
+
+    private_method foo => sub { return 23 };
+
+    sub mul_by_foo { my $self = shift; $self->foo * $_[0] }
+
     1;
 
     my $foo = Foo->new;
-    $foo->_foo; # die
-    $foo->foo;  # ok
+    $foo->foo; # die
+    $foo->mul_by_foo;  # ok
 
 =head2 Protected
 
@@ -73,20 +79,25 @@ When you declare a method as B<protected>, this method can be called only
 within the class AND any of it's subclasses.
 
     package Foo;
+
     use Moose;
     use MooseX::Privacy;
-    protected _foo => sub { return 23 };
+
+    protected_method foo => sub { return 23 };
 
     package Bar;
+
     use Moose;
     extends Foo;
-    sub foo { my $self = shift; $self->_foo }
+
+    sub bar { my $self = shift; $self->foo }
+
     1;
 
     my $foo = Foo->new;
-    $foo->_foo; # die
+    $foo->foo; # die
     my $bar = Bar->new;
-    $bar->foo;  # ok
+    $bar->bar;  # ok
 
 =head1 AUTHOR