summaryrefslogtreecommitdiff
path: root/lib/MooseX/Privacy/Meta/Class/Protected.pm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/MooseX/Privacy/Meta/Class/Protected.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/MooseX/Privacy/Meta/Class/Protected.pm b/lib/MooseX/Privacy/Meta/Class/Protected.pm
index aa5936e..3b80010 100644
--- a/lib/MooseX/Privacy/Meta/Class/Protected.pm
+++ b/lib/MooseX/Privacy/Meta/Class/Protected.pm
@@ -15,12 +15,20 @@ has local_protected_methods => (
);
sub add_protected_method {
- my ( $self, $method_name, $code ) = @_;
+ my $self = shift;
+ my ( $method_name, $body );
+ if ( scalar @_ == 1 ) {
+ $method_name = $_[0]->name;
+ $body = $_[0]->body;
+ }
+ else {
+ ($method_name, $body) = @_;
+ }
$self->add_method(
$method_name,
MooseX::Privacy::Meta::Method::Protected->wrap(
name => $method_name,
- body => $code,
+ body => $body,
package_name => $self->name
)
);
@@ -29,3 +37,4 @@ sub add_protected_method {
1;
+