1 package WebPAC::Input::MARC;
10 WebPAC::Input::MARC - support for MARC database files
18 our $VERSION = '0.04';
23 Open USMARC, Unimarc or any other file format that has same internal
24 structure using C<MARC::Fast>.
26 my $marc = new WebPAC::Input::MARC();
27 $marc->open( path => '/path/to/marc.iso' );
33 Returns handle to database
36 path => '/path/to/marc.iso'
46 my $log = $self->_get_logger();
48 $log->info("opening MARC database '$arg->{path}'");
50 my $db = new MARC::Fast( marcdb => $arg->{path});
51 my $db_size = $db->count - 1; # FIXME
53 $self->{_marc_size} = $db_size;
55 return ($db, $db_size);
60 Return record with ID C<$mfn> from database
62 my $rec = $self->fetch_rec( $db, $mfn );
73 if ($mfn > $self->{_marc_size}) {
74 $self->_get_logger()->warn("seek beyond database size $self->{_marc_size} to $mfn");
76 my $row = $db->to_hash($mfn);
77 push @{$row->{'000'}}, $mfn;
86 Store size of MARC database
88 print $self->{_marc_size};
94 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
96 =head1 COPYRIGHT & LICENSE
98 Copyright 2005 Dobrica Pavlinusic, All Rights Reserved.
100 This program is free software; you can redistribute it and/or modify it
101 under the same terms as Perl itself.
105 1; # End of WebPAC::Input::MARC