From 26c16f1c9431ddbcbd1d7bb85df106a12f2a9ef0 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Wed, 10 Feb 2010 16:37:42 +0100 Subject: update readme --- README | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/README b/README index 950e8c0..95b819b 100644 --- a/README +++ b/README @@ -4,19 +4,55 @@ NAME SYNOPSIS use MooseX::Privacy; - private foo => sub { + private _foo => sub { return 23; }; - protect bar => sub { + protected _bar => sub { return 42; }; DESCRIPTION - MooseX::Privacy is + MooseX::Privacy brings the concept of private and protected methods to + your class. + + Private + When you declare a method as private, the 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 } + 1; + + my $foo = Foo->new; + $foo->_foo; # die + $foo->foo; # ok + + Protected + When you declare a method as protected, the method can be called only + within the class AND any subclasses. + + package Foo; + use Moose; + use MooseX::Privacy; + protected _foo => sub { return 23 }; + + package Bar; + use Moose; + extends Foo; + sub foo { my $self = shift; $self->_foo } + 1; + + my $foo = Foo->new; + $foo->_foo; # die + my $bar = Bar->new; + $bar->foo; # ok AUTHOR - franck cuny + franck cuny SEE ALSO LICENSE -- cgit 1.4.1