From: Shawn M Moore Date: Sun, 27 Jan 2008 15:24:04 +0000 (+0000) Subject: Some simplifications and corrections suggested by nothingmuch++ X-Git-Tag: 0_53~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3f59a80e550509f975bc9f8e40d47fa72af0b0ad;p=gitmo%2FClass-MOP.git Some simplifications and corrections suggested by nothingmuch++ --- diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index 458b084..a9612a9 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -124,16 +124,12 @@ sub rebless_instance_structure { sub get_all_slot_values { my ($self, $instance) = @_; - my $class = $self->associated_metaclass; - my %map; - for my $attr ($class->compute_all_applicable_attributes) { - my $name = $attr->name; - $map{$name} = $self->get_slot_value($instance, $name) - if $self->is_slot_initialized($instance, $name); - } - - return \%map; + return +{ + map { $_->name => $_->get_value($instance) } + grep { $_->has_value($instance) } + $self->associated_metaclass->compute_all_applicable_attributes + }; } # inlinable operation snippets