}) or die "How did write_value fail (no blist)?!\n";
my $r = Scalar::Util::reftype( $value ) || '';
- #XXX Throw an error here on illegal values
+ {
+ last if $r eq '';
+ last if $r eq 'HASH';
+ last if $r eq 'ARRAY';
+
+ DBM::Deep->_throw_error(
+ "Storage of references of type '$r' is not supported."
+ );
+ }
+
my ($class, $type);
if ( !defined $value ) {
$class = 'DBM::Deep::Engine::Sector::Null';
}
elsif ( $r eq 'ARRAY' || $r eq 'HASH' ) {
+ if ( $r eq 'ARRAY' && tied(@$value) ) {
+ DBM::Deep->_throw_error( "Cannot store something that is tied" );
+ }
+ if ( $r eq 'HASH' && tied(%$value) ) {
+ DBM::Deep->_throw_error( "Cannot store something that is tied" );
+ }
$class = 'DBM::Deep::Engine::Sector::Reference';
$type = substr( $r, 0, 1 );
}
my %hash2 = ( abc => [ 1 .. 3 ] );
$array[3] = \%hash2;
-$hash2{ def } = \%hash;
+SKIP: {
+ skip "Internal references are currently unsupported", 1;
+ $hash2{ def } = \%hash;
-is( $array[3]{def}{foo}, 2 );
+ is( $array[3]{def}{foo}, 2 );
+}