From: Yuval Kogman Date: Fri, 8 Aug 2008 22:13:34 +0000 (+0000) Subject: also remove perl6isms from examples X-Git-Tag: 0_64_01~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1fdb86fb486a14a2cb3a85bc618365ca98d75a4a;p=gitmo%2FClass-MOP.git also remove perl6isms from examples --- diff --git a/examples/ArrayBasedStorage.pod b/examples/ArrayBasedStorage.pod index e4c2cee..43b459d 100644 --- a/examples/ArrayBasedStorage.pod +++ b/examples/ArrayBasedStorage.pod @@ -17,7 +17,7 @@ sub new { my ($class, $meta, @attrs) = @_; my $self = $class->SUPER::new($meta, @attrs); my $index = 0; - $self->{'%!slot_index_map'} = { map { $_ => $index++ } $self->get_all_slots }; + $self->{'slot_index_map'} = { map { $_ => $index++ } $self->get_all_slots }; return $self; } @@ -35,7 +35,7 @@ sub clone_instance { # operations on meta instance -sub get_slot_index_map { (shift)->{'%!slot_index_map'} } +sub get_slot_index_map { (shift)->{'slot_index_map'} } sub initialize_slot { my ($self, $instance, $slot_name) = @_; @@ -54,20 +54,20 @@ sub get_all_slots { sub get_slot_value { my ($self, $instance, $slot_name) = @_; - my $value = $instance->[ $self->{'%!slot_index_map'}->{$slot_name} ]; + my $value = $instance->[ $self->{'slot_index_map'}->{$slot_name} ]; return $value unless ref $value; refaddr $value eq refaddr $unbound ? undef : $value; } sub set_slot_value { my ($self, $instance, $slot_name, $value) = @_; - $instance->[ $self->{'%!slot_index_map'}->{$slot_name} ] = $value; + $instance->[ $self->{'slot_index_map'}->{$slot_name} ] = $value; } sub is_slot_initialized { my ($self, $instance, $slot_name) = @_; # NOTE: maybe use CLOS's *special-unbound-value* for this? - my $value = $instance->[ $self->{'%!slot_index_map'}->{$slot_name} ]; + my $value = $instance->[ $self->{'slot_index_map'}->{$slot_name} ]; return 1 unless ref $value; refaddr $value eq refaddr $unbound ? 0 : 1; } diff --git a/examples/AttributesWithHistory.pod b/examples/AttributesWithHistory.pod index 9d2c4b5..5d7ca19 100644 --- a/examples/AttributesWithHistory.pod +++ b/examples/AttributesWithHistory.pod @@ -12,7 +12,7 @@ use base 'Class::MOP::Attribute'; # this is for an extra attribute constructor # option, which is to be able to create a # way for the class to access the history -AttributesWithHistory->meta->add_attribute('$!history_accessor' => ( +AttributesWithHistory->meta->add_attribute('history_accessor' => ( reader => 'history_accessor', init_arg => 'history_accessor', predicate => 'has_history_accessor', @@ -20,7 +20,7 @@ AttributesWithHistory->meta->add_attribute('$!history_accessor' => ( # this is a place to store the actual # history of the attribute -AttributesWithHistory->meta->add_attribute('$!_history' => ( +AttributesWithHistory->meta->add_attribute('_history' => ( accessor => '_history', default => sub { {} }, ));