##
# Recursively import Perl hash/array structure
##
- #XXX This use of ref() seems to be ok
if (!ref($_[0])) { return; } # Perl calls import() on use -- ignore
my $self = shift->_get_self;
my ($struct) = @_;
- #XXX This use of ref() seems to be ok
+ # struct is not a reference, so just import based on our type
if (!ref($struct)) {
- ##
- # struct is not a reference, so just import based on our type
- ##
- shift @_;
-
if ($self->_type eq TYPE_HASH) { $struct = {@_}; }
elsif ($self->_type eq TYPE_ARRAY) { $struct = [@_]; }
}
is( $db->[-3], $db->[2], "-3rd index is 2nd index" );
is( $db->[-4], $db->[1], "-4th index is 1st index" );
is( $db->[-5], $db->[0], "-5th index is 0th index" );
-is( $db->[-6], undef, "-6th index is undef" );
+
+# This is for Perls older than 5.8.0 because of is()'s prototype
+{ my $v = $db->[-6]; is( $v, undef, "-6th index is undef" ); }
+
is( $db->length, 5, "... and we have five elements after abortive -6 index lookup" );
$db->[-1] = 'elem4.1';
$db->import(
hash1 => {
subkey1 => "subvalue1",
- subkey2 => "subvalue2"
+ subkey2 => "subvalue2",
}
);
-
is( $db->{hash1}{subkey1}, 'subvalue1', "Value imported correctly" );
is( $db->{hash1}{subkey2}, 'subvalue2', "Value imported correctly" );