BEGIN {
use Exporter ();
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- $VERSION = 0.03;
+ $VERSION = 0.04;
@ISA = qw (Exporter);
#Give a hoot don't pollute, do not export more than needed by default
@EXPORT = qw ();
debug => 0,
assert => 0,
hash_filter => sub {
- my $t = shift;
+ my ($t, $record_number) = @_;
$t =~ s/foo/bar/;
return $t;
},
my $row = $self->fetch($mfn) || return;
- foreach my $k (keys %{$row}) {
- foreach my $l (@{$row->{$k}}) {
+ foreach my $rec_nr (keys %{$row}) {
+ foreach my $l (@{$row->{$rec_nr}}) {
# remove end marker
$l =~ s/\x1E$//;
# filter output
- $l = $self->{'hash_filter'}->($l) if ($self->{'hash_filter'});
+ $l = $self->{'hash_filter'}->($l, $rec_nr) if ($self->{'hash_filter'});
my $val;
# of this record. Then, new record with same
# identifiers will be created.
if ($val->{$f}) {
- push @{$rec->{$k}}, $val;
+ push @{$rec->{$rec_nr}}, $val;
$val = {
i1 => $val->{i1},
i2 => $val->{i2},
$val = $l;
}
- push @{$rec->{$k}}, $val;
+ push @{$rec->{$rec_nr}}, $val;
}
}
isa_ok ($marc, 'MARC::Fast');
+ #diag Dumper($marc);
+
cmp_ok($marc->count, '==', scalar @{$marc->{leaders}}, "count == leaders");
cmp_ok($marc->count, '==', scalar @{$marc->{fh_offset}}, "count == fh_offset");
foreach (1 .. 10) {
ok($marc->fetch($_), "fetch $_");
+
+ ok(my $hash = $marc->to_hash($_), "to_hash $_");
+ diag "$_ :: ",Dumper($hash);
}
}