substr $start_of_data, 4, $length;
}
+sub seek_and_read_ref_and_data {
+ my ($self, $index) = @_;
+ my $ref = $self->seek_and_read_ref($index);
+ my $bin = $self->seek_and_read_storage_bin($ref->{bin_index});
+ my $data = $self->get_entry_of_storage_bin($bin, $ref->{item_index});
+ $ref->{data} = $data;
+ $ref
+}
+
1;
__END__
say "Value at position $second_ref->{item_index} is ",
$slob->get_entry_of_storage_bin($bin, $second_ref->{item_index});
+ # instead of the above, we can do
+ my $second_ref_and_data = $slob->seek_and_read_ref_and_data(4);
+ say "Entry is for $second_ref_and_data->{key}";
+ say "Value is $second_ref_and_data->{data}";
+
=head1 DESCRIPTION
No documentation yet, see SYNOPSIS.
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 7;
BEGIN { use_ok('Slob') };
my $slob = Slob->new('t/freedict-01.slob');
EOF
chomp $expected;
is $slob->get_entry_of_storage_bin($bin, $second_ref->{item_index}), $expected;
+
+is $slob->seek_and_read_ref_and_data(4)->{data}, $expected;