X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FInstance.pm;h=a9612a9309fe3cb79525fa6f99292df654f7ed25;hb=3f59a80e550509f975bc9f8e40d47fa72af0b0ad;hp=008815ea80bdcbc4aa1a4aa46264541c07ed3fbd;hpb=8d2d4c6705a3781606464d003a3641d835a35815;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index 008815e..a9612a9 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -108,13 +108,28 @@ sub is_slot_initialized { } sub weaken_slot_value { - my ($self, $instance, $slot_name) = @_; - weaken $instance->{$slot_name}; + my ($self, $instance, $slot_name) = @_; + weaken $instance->{$slot_name}; } sub strengthen_slot_value { - my ($self, $instance, $slot_name) = @_; - $self->set_slot_value($instance, $slot_name, $self->get_slot_value($instance, $slot_name)); + my ($self, $instance, $slot_name) = @_; + $self->set_slot_value($instance, $slot_name, $self->get_slot_value($instance, $slot_name)); +} + +sub rebless_instance_structure { + my ($self, $instance, $metaclass) = @_; + bless $instance, $metaclass->name; +} + +sub get_all_slot_values { + my ($self, $instance) = @_; + + return +{ + map { $_->name => $_->get_value($instance) } + grep { $_->has_value($instance) } + $self->associated_metaclass->compute_all_applicable_attributes + }; } # inlinable operation snippets @@ -269,6 +284,8 @@ require that the C<$instance_structure> is passed into them. =item B +=item B + =item B =item B @@ -283,6 +300,8 @@ require that the C<$instance_structure> is passed into them. =item B +=item B + =back =head2 Inlineable Instance Operations @@ -329,7 +348,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006, 2007 by Infinity Interactive, Inc. +Copyright 2006-2008 by Infinity Interactive, Inc. L