From: Dave Rolsky Date: Tue, 22 Feb 2011 23:40:24 +0000 (-0600) Subject: make slot manipulation methods private X-Git-Tag: v0.24~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5ed69bcccc24de628b7bd416423c9f2fcace667;p=gitmo%2FMooseX-ClassAttribute.git make slot manipulation methods private --- diff --git a/lib/MooseX/ClassAttribute/Trait/Attribute.pm b/lib/MooseX/ClassAttribute/Trait/Attribute.pm index 966eb08..1432331 100644 --- a/lib/MooseX/ClassAttribute/Trait/Attribute.pm +++ b/lib/MooseX/ClassAttribute/Trait/Attribute.pm @@ -119,7 +119,7 @@ if ( $Moose::VERSION < 1.99 ) { my $self = shift; return $self->associated_class() - ->inline_get_class_slot_value( $self->slots() ); + ->_inline_get_class_slot_value( $self->slots() ); }; around inline_set => sub { @@ -131,10 +131,10 @@ if ( $Moose::VERSION < 1.99 ) { my $meta = $self->associated_class(); my $code - = $meta->inline_set_class_slot_value( $self->slots(), $value ) + = $meta->_inline_set_class_slot_value( $self->slots(), $value ) . ";"; $code - .= $meta->inline_weaken_class_slot_value( $self->slots(), $value ) + .= $meta->_inline_weaken_class_slot_value( $self->slots(), $value ) . " if ref $value;" if $self->is_weak_ref(); @@ -146,7 +146,7 @@ if ( $Moose::VERSION < 1.99 ) { my $self = shift; return $self->associated_class() - ->inline_is_class_slot_initialized( $self->slots() ); + ->_inline_is_class_slot_initialized( $self->slots() ); }; around inline_clear => sub { @@ -154,7 +154,7 @@ if ( $Moose::VERSION < 1.99 ) { my $self = shift; return $self->associated_class() - ->inline_deinitialize_class_slot( $self->slots() ); + ->_inline_deinitialize_class_slot( $self->slots() ); }; } else { @@ -163,7 +163,7 @@ else { my $self = shift; return $self->associated_class() - ->inline_get_class_slot_value( $self->slots() ); + ->_inline_get_class_slot_value( $self->slots() ); }; around _inline_instance_set => sub { @@ -173,7 +173,7 @@ else { my $value = shift; return $self->associated_class() - ->inline_set_class_slot_value( $self->slots(), $value ); + ->_inline_set_class_slot_value( $self->slots(), $value ); }; around _inline_instance_has => sub { @@ -181,7 +181,7 @@ else { my $self = shift; return $self->associated_class() - ->inline_is_class_slot_initialized( $self->slots() ); + ->_inline_is_class_slot_initialized( $self->slots() ); }; around _inline_instance_clear => sub { @@ -189,7 +189,7 @@ else { my $self = shift; return $self->associated_class() - ->inline_deinitialize_class_slot( $self->slots() ); + ->_inline_deinitialize_class_slot( $self->slots() ); }; around _inline_weaken_value => sub { @@ -201,7 +201,7 @@ else { return unless $self->is_weak_ref(); return ( - $self->associated_class->inline_weaken_class_slot_value( + $self->associated_class->_inline_weaken_class_slot_value( $self->slots(), $value ), 'if ref ' . $value . ';', diff --git a/lib/MooseX/ClassAttribute/Trait/Class.pm b/lib/MooseX/ClassAttribute/Trait/Class.pm index 18b403f..daa2ccb 100644 --- a/lib/MooseX/ClassAttribute/Trait/Class.pm +++ b/lib/MooseX/ClassAttribute/Trait/Class.pm @@ -175,7 +175,7 @@ sub _class_attribute_var_name { return $self->name() . q'::__ClassAttributeValues'; } -sub inline_class_slot_access { +sub _inline_class_slot_access { my $self = shift; my $name = shift; @@ -185,42 +185,42 @@ sub inline_class_slot_access { . quotemeta($name) . '"}'; } -sub inline_get_class_slot_value { +sub _inline_get_class_slot_value { my $self = shift; my $name = shift; - return $self->inline_class_slot_access($name); + return $self->_inline_class_slot_access($name); } -sub inline_set_class_slot_value { +sub _inline_set_class_slot_value { my $self = shift; my $name = shift; my $val_name = shift; - return $self->inline_class_slot_access($name) . ' = ' . $val_name; + return $self->_inline_class_slot_access($name) . ' = ' . $val_name; } -sub inline_is_class_slot_initialized { +sub _inline_is_class_slot_initialized { my $self = shift; my $name = shift; - return 'exists ' . $self->inline_class_slot_access($name); + return 'exists ' . $self->_inline_class_slot_access($name); } -sub inline_deinitialize_class_slot { +sub _inline_deinitialize_class_slot { my $self = shift; my $name = shift; - return 'delete ' . $self->inline_class_slot_access($name); + return 'delete ' . $self->_inline_class_slot_access($name); } -sub inline_weaken_class_slot_value { +sub _inline_weaken_class_slot_value { my $self = shift; my $name = shift; return 'Scalar::Util::weaken( ' - . $self->inline_class_slot_access($name) . ')'; + . $self->_inline_class_slot_access($name) . ')'; } 1; @@ -294,25 +294,6 @@ you're doing some deep hacking. They are named as public methods solely because they are used by other meta roles and classes in this distribution. -=head2 $meta->inline_class_slot_access($name) - -=head2 $meta->inline_get_class_slot_value($name) - -=head2 $meta->inline_set_class_slot_value($name, $val_name) - -=head2 $meta->inline_is_class_slot_initialized($name) - -=head2 $meta->inline_deinitialize_class_slot($name) - -=head2 $meta->inline_weaken_class_slot_value($name) - -These methods return code snippets for inlining. - -There's really no good reason for you to call these methods unless -you're doing some deep hacking. They are named as public methods -solely because they are used by other meta roles and classes in this -distribution. - =head1 BUGS See L for details.