12 |
|
|
13 |
=head1 VERSION |
=head1 VERSION |
14 |
|
|
15 |
Version 0.06 |
Version 0.07 |
16 |
|
|
17 |
=cut |
=cut |
18 |
|
|
19 |
our $VERSION = '0.06'; |
our $VERSION = '0.07'; |
20 |
|
|
21 |
|
|
22 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
72 |
|
|
73 |
my $size = $isis_db->count; |
my $size = $isis_db->count; |
74 |
|
|
75 |
|
$self->{_isis_db} = $isis_db; |
76 |
|
|
77 |
return ($isis_db, $size); |
return ($isis_db, $size); |
78 |
} |
} |
79 |
|
|
81 |
|
|
82 |
Return record with ID C<$mfn> from database |
Return record with ID C<$mfn> from database |
83 |
|
|
84 |
my $rec = $self->fetch_rec( $db, $mfn, $filter_coderef); |
my $rec = $self->fetch_rec( $mfn, $filter_coderef); |
85 |
|
|
86 |
=cut |
=cut |
87 |
|
|
88 |
sub fetch_rec { |
sub fetch_rec { |
89 |
my $self = shift; |
my $self = shift; |
90 |
|
|
91 |
my ($isis_db, $mfn, $filter_coderef) = @_; |
my ($mfn, $filter_coderef) = @_; |
|
|
|
|
use Data::Dump qw/dump/; |
|
|
warn "fetch_rec filter_coderef = ", dump($filter_coderef), $/; |
|
92 |
|
|
93 |
my $rec = $isis_db->to_hash({ |
my $rec = $self->{_isis_db}->to_hash({ |
94 |
mfn => $mfn, |
mfn => $mfn, |
95 |
include_subfields => 1, |
include_subfields => 1, |
96 |
hash_filter => sub { |
hash_filter => $filter_coderef, |
97 |
my ($l,$f) = @_; |
# hash_filter => sub { |
98 |
warn "## in hash_filter ($l,$f)\n"; |
# my ($l,$f) = @_; |
99 |
my $o = $filter_coderef->($l,$f); |
# warn "## in hash_filter ($l,$f)\n"; |
100 |
warn "## out hash_filter = $o\n"; |
# my $o = $filter_coderef->($l,$f) if ($filter_coderef); |
101 |
return $o; |
# warn "## out hash_filter = $o\n"; |
102 |
}, |
# return $o; |
103 |
|
# }, |
104 |
}); |
}); |
105 |
|
|
106 |
return $rec; |
return $rec; |
107 |
} |
} |
108 |
|
|
109 |
|
=head2 dump_rec |
110 |
|
|
111 |
|
Return dump of record ID C<$mfn> from database |
112 |
|
|
113 |
|
my $rec = $self->dump_rec( $db, $mfn ); |
114 |
|
|
115 |
|
=cut |
116 |
|
|
117 |
|
sub dump_rec { |
118 |
|
my $self = shift; |
119 |
|
|
120 |
|
my $mfn = shift; |
121 |
|
|
122 |
|
return $self->{_isis_db}->to_ascii( $mfn ); |
123 |
|
} |
124 |
|
|
125 |
=head1 AUTHOR |
=head1 AUTHOR |
126 |
|
|
127 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |