From: rkinyon Date: Mon, 19 Jun 2006 13:57:53 +0000 (+0000) Subject: r14451@Rob-Kinyons-PowerBook: rob | 2006-06-19 09:57:27 -0400 X-Git-Tag: 0-983^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0-983;p=dbsrgits%2FDBM-Deep.git r14451@Rob-Kinyons-PowerBook: rob | 2006-06-19 09:57:27 -0400 Fixing repos --- diff --git a/Deep.pm.patch b/Deep.pm.patch deleted file mode 100644 index 95a2037..0000000 --- a/Deep.pm.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- DBM-Deep-0.983/lib/DBM/Deep.pm 2006-04-10 21:59:17.000000000 -0500 -+++ DBM-Deep-0.983_copy/lib/DBM/Deep.pm 2006-06-15 10:15:07.569349000 -0500 -@@ -149,7 +149,9 @@ - tie %$self, $class, %$args; - } - -- return bless $self, $class; -+ bless $self, $class; -+ $self->_set_ref($self); -+ return $self; - } - - sub _init { -@@ -604,6 +606,8 @@ - root => $root, - }; - %$value = %x; -+ bless $value, 'DBM::Deep::Hash'; -+ $value->_set_ref($value); - } - elsif ($r eq 'ARRAY') { - my @x = @$value; -@@ -613,6 +617,8 @@ - root => $root, - }; - @$value = @x; -+ bless $value, 'DBM::Deep::Array'; -+ $value->_set_ref($value); - } - - return $result; -@@ -663,7 +669,8 @@ - # If value is a hash or array, return new DBM::Deep object with correct offset - ## - if (($signature eq TYPE_HASH) || ($signature eq TYPE_ARRAY)) { -- my $obj = DBM::Deep->new( -+ my $obj = $self->_get_ref($subloc); -+ $obj ||= DBM::Deep->new( - type => $signature, - base_offset => $subloc, - root => $self->_root -@@ -1221,6 +1228,20 @@ - return $self->{base_offset}; - } - -+sub _set_ref { -+ my $self = $_[0]->_get_self; -+ my $base_offset = $self->_base_offset; -+ my $refs = $self->_root->{refs}; -+ $refs->{$base_offset} = $_[1]; -+ Scalar::Util::weaken $refs->{$base_offset}; -+} -+ -+sub _get_ref { -+ my $self = $_[0]->_get_self; -+ my $refs = $self->_root->{refs}; -+ return $refs->{ $_[1] }; -+} -+ - sub error { - ## - # Get last error string, or undef if no error -@@ -1585,6 +1606,7 @@ - filter_fetch_value => undef, - autobless => undef, - locked => 0, -+ refs => {}, - %$args, - }, $class; - - diff --git a/t/39_singletons.t b/t/39_singletons.t deleted file mode 100644 index 2681931..0000000 --- a/t/39_singletons.t +++ /dev/null @@ -1,18 +0,0 @@ -use strict; -use Test::More tests => 2; - -use_ok( 'DBM::Deep' ); - -unlink 't/test.db'; -my $db = DBM::Deep->new( - file => "t/test.db", - locking => 1, - autoflush => 1, -); - -$db->{foo} = { a => 'b' }; -my $x = $db->{foo}; -my $y = $db->{foo}; -is( $x, $y, "The references are the same" ); - -