license => 'perl',
requires => {
'perl' => '5.6.0',
+ 'Clone::Any' => '0',
'Digest::MD5' => '1.00',
'Fcntl' => '0.01',
'FileHandle::Fmode' => '0.05',
our $VERSION = q(0.99_03);
use Fcntl qw( :DEFAULT :flock :seek );
+
+use Clone::Any '_clone_data';
use Digest::MD5 ();
use FileHandle::Fmode ();
use Scalar::Util ();
$struct = $self->_repr( @_ );
}
-#XXX These are correct, but impossible until the other bug is fixed
+ #XXX This isn't the best solution. Better would be to use Data::Walker,
+ #XXX but that's a lot more thinking than I want to do right now.
eval {
-# $self->begin_work;
- $self->_import( $struct );
-# $self->commit;
+ $self->begin_work;
+ $self->_import( _clone_data( $struct ) );
+ $self->commit;
}; if ( $@ ) {
$self->rollback;
die $@;
eval { local $SIG{'__DIE__'}; tied( %{$_[0]} ) } || $_[0]
}
+#XXX Need to add a check here for @_ % 2
sub _repr { shift;return { @_ } }
sub _import {
$struct->{hash1}->{foo} = 'bar';
is( $struct->{hash1}->{foo}, 'bar', "\$struct->{hash1} has foo and it's 'bar'" );
ok( !exists $db->{hash1}->{foo}, "\$db->{hash1} doesn't have the 'foo' key, so \$struct->{hash1} is not tied" );
+
+__END__
+
+Need to add tests for:
+ - Failure case (have something tied or a glob or something like that)
+ - Where we already have $db->{hash1} to make sure that it's not overwritten