/[webpac2]/trunk/lib/WebPAC/Input/ISIS.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

Diff of /trunk/lib/WebPAC/Input/ISIS.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 725 by dpavlin, Thu Sep 7 15:01:45 2006 UTC revision 726 by dpavlin, Fri Sep 29 19:52:17 2006 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  use WebPAC::Input;  use WebPAC::Input;
7  use Biblio::Isis 0.23;  use Biblio::Isis 0.23;
8    use base qw/WebPAC::Common/;
9    
10  =head1 NAME  =head1 NAME
11    
# Line 12  WebPAC::Input::ISIS - support for CDS/IS Line 13  WebPAC::Input::ISIS - support for CDS/IS
13    
14  =head1 VERSION  =head1 VERSION
15    
16  Version 0.07  Version 0.08
17    
18  =cut  =cut
19    
20  our $VERSION = '0.07';  our $VERSION = '0.08';
21    
22    
23  =head1 SYNOPSIS  =head1 SYNOPSIS
# Line 24  our $VERSION = '0.07'; Line 25  our $VERSION = '0.07';
25  Open CDS/ISIS, WinISIS or IsisMarc database using C<Biblio::Isis>  Open CDS/ISIS, WinISIS or IsisMarc database using C<Biblio::Isis>
26  and read all records to memory.  and read all records to memory.
27    
28   my $isis = new WebPAC::Input::ISIS();   my $isis = new WebPAC::Input::ISIS(
29   $isis->open( path => '/path/to/ISIS/ISIS' );          path => '/path/to/ISIS/ISIS',
30     );
31    
32  =head1 FUNCTIONS  =head1 FUNCTIONS
33    
34  =head2 open_db  =head2 new
35    
36  Returns handle to database and size in records  Returns new low-level input API object
37    
38    my ($db,$size) = $isis->open_db(    my $isis = new WebPAC::Input::ISIS(
39          path => '/path/to/LIBRI'          path => '/path/to/LIBRI'
40          filter => sub {          filter => sub {
41                  my ($l,$field_nr) = @_;                  my ($l,$field_nr) = @_;
# Line 54  path to CDS/ISIS database Line 56  path to CDS/ISIS database
56    
57  =cut  =cut
58    
59  sub open_db {  sub new {
60          my $self = shift;          my $class = shift;
61            my $self = {@_};
62            bless($self, $class);
63    
64          my $arg = {@_};          my $arg = {@_};
65    
# Line 70  sub open_db { Line 74  sub open_db {
74                  hash_filter => $arg->{filter} ? sub { return $arg->{filter}->(@_); } : undef,                  hash_filter => $arg->{filter} ? sub { return $arg->{filter}->(@_); } : undef,
75          ) or $log->logdie("can't find database $arg->{path}");          ) or $log->logdie("can't find database $arg->{path}");
76    
         my $size = $isis_db->count;  
   
77          $self->{_isis_db} = $isis_db;          $self->{_isis_db} = $isis_db;
78    
79          return ($isis_db, $size);          $self ? return $self : return undef;
80  }  }
81    
82  =head2 fetch_rec  =head2 fetch_rec
83    
84  Return record with ID C<$mfn> from database  Return record with ID C<$mfn> from database
85    
86    my $rec = $self->fetch_rec( $mfn, $filter_coderef);    my $rec = $isis->fetch_rec( $mfn, $filter_coderef);
87    
88  =cut  =cut
89    
# Line 110  sub fetch_rec { Line 112  sub fetch_rec {
112    
113  Return dump of record ID C<$mfn> from database  Return dump of record ID C<$mfn> from database
114    
115    my $rec = $self->dump_rec( $db, $mfn );    my $rec = $isis->dump_rec( $db, $mfn );
116    
117  =cut  =cut
118    
# Line 122  sub dump_rec { Line 124  sub dump_rec {
124          return $self->{_isis_db}->to_ascii( $mfn );          return $self->{_isis_db}->to_ascii( $mfn );
125  }  }
126    
127    =head2 size
128    
129    Return number of records in database
130    
131      my $size = $isis->size;
132    
133    =cut
134    
135    sub size {
136            my $self = shift;
137            return $self->{_isis_db}->count;
138    }
139    
140  =head1 AUTHOR  =head1 AUTHOR
141    
142  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>

Legend:
Removed from v.725  
changed lines
  Added in v.726

  ViewVC Help
Powered by ViewVC 1.1.26