X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStorage%2FEngine.pm;h=9969d5a75be26bac1830c409a64d6f06ddbd1a20;hb=8b2ba857269b040d3a0f11f3d95e2c5b9af44415;hp=bcc87ae8ad8a661cd97844670af3653810d5a869;hpb=acf1df17928851cd2253de13bfe7b6fe1edfcc49;p=gitmo%2FMooseX-Storage.git diff --git a/lib/MooseX/Storage/Engine.pm b/lib/MooseX/Storage/Engine.pm index bcc87ae..9969d5a 100644 --- a/lib/MooseX/Storage/Engine.pm +++ b/lib/MooseX/Storage/Engine.pm @@ -26,13 +26,13 @@ has 'class' => (is => 'rw', isa => 'Str'); sub collapse_object { my ( $self, %options ) = @_; - # NOTE: - # mark the root object as seen ... - $self->seen->{refaddr $self->object} = undef; - + # NOTE: + # mark the root object as seen ... + $self->seen->{refaddr $self->object} = undef; + $self->map_attributes('collapse_attribute', \%options); $self->storage->{$CLASS_MARKER} = $self->object->meta->identifier; - return $self->storage; + return $self->storage; } sub expand_object { @@ -41,12 +41,12 @@ sub expand_object { $options{check_version} = 1 unless exists $options{check_version}; $options{check_authority} = 1 unless exists $options{check_authority}; - # NOTE: - # mark the root object as seen ... - $self->seen->{refaddr $data} = undef; + # NOTE: + # mark the root object as seen ... + $self->seen->{refaddr $data} = undef; $self->map_attributes('expand_attribute', $data, \%options); - return $self->storage; + return $self->storage; } ## this is the internal API ... @@ -67,13 +67,13 @@ sub expand_attribute { sub collapse_attribute_value { my ($self, $attr, $options) = @_; # Faster, but breaks attributes without readers, do we care? - #my $value = $attr->get_read_method_ref->($self->object); - my $value = $attr->get_value($self->object); + #my $value = $attr->get_read_method_ref->($self->object); + my $value = $attr->get_value($self->object); - # NOTE: - # this might not be enough, we might - # need to make it possible for the - # cycle checker to return the value + # NOTE: + # this might not be enough, we might + # need to make it possible for the + # cycle checker to return the value $self->check_for_cycle_in_collapse($attr, $value) if ref $value; @@ -83,14 +83,14 @@ sub collapse_attribute_value { || confess "Cannot convert " . $attr->type_constraint->name; $value = $type_converter->{collapse}->($value, $options); } - return $value; + return $value; } sub expand_attribute_value { my ($self, $attr, $value, $options) = @_; - # NOTE: - # (see comment in method above ^^) + # NOTE: + # (see comment in method above ^^) if( ref $value and not( $options->{disable_cycle_check} or $self->class->does('MooseX::Storage::Traits::DisableCycleDetection') @@ -102,7 +102,7 @@ sub expand_attribute_value { my $type_converter = $self->find_type_handler($attr->type_constraint, $value); $value = $type_converter->{expand}->($value, $options); } - return $value; + return $value; } # NOTE: