/[webpac2]/trunk/lib/WebPAC/Input/MARC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/WebPAC/Input/MARC.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 289 - (show annotations)
Sun Dec 18 22:16:44 2005 UTC (18 years, 4 months ago) by dpavlin
File size: 1309 byte(s)
 r11784@llin:  dpavlin | 2005-12-19 05:17:24 +0100
 don't use Exporter after all

1 package WebPAC::Input::MARC;
2
3 use warnings;
4 use strict;
5
6 use blib;
7
8 use WebPAC::Common;
9 use MARC::Fast;
10
11 =head1 NAME
12
13 WebPAC::Input::MARC - support for MARC database files
14
15 =head1 VERSION
16
17 Version 0.01
18
19 =cut
20
21 our $VERSION = '0.01';
22
23
24 =head1 SYNOPSIS
25
26 Open USMARC, Unimarc or any other file format that has same internal
27 structure using C<MARC::Fast>.
28
29 my $marc = new WebPAC::Input::MARC();
30 $marc->open( path => '/path/to/marc.iso' );
31
32 =head1 FUNCTIONS
33
34 =head2 open_db
35
36 Returns handle to database
37
38 my $db = $open_db(
39 path => '/path/to/marc.iso'
40 }
41
42 =cut
43
44 sub open_db {
45 my $self = shift;
46
47 my $arg = {@_};
48
49 my $log = $self->_get_logger();
50
51 $log->info("opening MARC database '$arg->{path}'");
52
53 my $db = new MARC::Fast( marcdb => $arg->{path});
54 my $db_size = $db->count;
55
56 return ($db, $db_size);
57 }
58
59 =head2 fetch_rec
60
61 Return record with ID C<$mfn> from database
62
63 my $rec = $self->fetch_rec( $db, $mfn );
64
65 }
66
67 =cut
68
69 sub fetch_rec {
70 my $self = shift;
71
72 my ($db, $mfn) = @_;
73
74 return $db->fetch($mfn);
75 }
76
77 =head1 AUTHOR
78
79 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
80
81 =head1 COPYRIGHT & LICENSE
82
83 Copyright 2005 Dobrica Pavlinusic, All Rights Reserved.
84
85 This program is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself.
87
88 =cut
89
90 1; # End of WebPAC::Input::MARC

  ViewVC Help
Powered by ViewVC 1.1.26