From: rkinyon Date: Wed, 7 Jun 2006 18:35:16 +0000 (+0000) Subject: r13607@rob-kinyons-powerbook58: rob | 2006-05-25 15:12:31 -0400 X-Git-Tag: 0-99_03~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bd01f6ece548569503416cc1af17f72d7bd532cc;p=dbsrgits%2FDBM-Deep.git r13607@rob-kinyons-powerbook58: rob | 2006-05-25 15:12:31 -0400 We now bless the tying of assignments unless they're tied --- diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 723c029..e0e9fc2 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -575,6 +575,7 @@ sub _write_value { parent_key => $orig_key, }; %$value = %x; + bless $value, 'DBM::Deep::Hash' unless Scalar::Util::blessed( $value ); } elsif ($r eq 'ARRAY') { my @x = @$value; @@ -585,6 +586,7 @@ sub _write_value { parent_key => $orig_key, }; @$value = @x; + bless $value, 'DBM::Deep::Array' unless Scalar::Util::blessed( $value ); } return 1; @@ -678,6 +680,31 @@ sub read_from_loc { ## if (($signature eq SIG_HASH) || ($signature eq SIG_ARRAY)) { #XXX This needs to be a singleton +# my $new_obj; +# my $is_autobless; +# if ( $signature eq SIG_HASH ) { +# $new_obj = {}; +# tie %$new_obj, 'DBM::Deep', { +# base_offset => $subloc, +# fileobj => $self->_fileobj, +# parent => $self->{obj}, +# parent_key => $orig_key, +# }; +# $is_autobless = tied(%$new_obj)->_fileobj->{autobless}; +# } +# else { +# $new_obj = []; +# tie @$new_obj, 'DBM::Deep', { +# base_offset => $subloc, +# fileobj => $self->_fileobj, +# parent => $self->{obj}, +# parent_key => $orig_key, +# }; +# $is_autobless = tied(@$new_obj)->_fileobj->{autobless}; +# } +# +# if ($is_autobless) { + my $new_obj = DBM::Deep->new({ type => $signature, base_offset => $subloc,