1 package WebPAC::Input::Koha;
8 use base qw/WebPAC::Common/;
13 WebPAC::Input::Koha - read MARC records from Koha
17 our $VERSION = '0.01';
23 my $input = new WebPAC::Input::Koha(
37 my $log = $self->_get_logger();
39 $log->info("opening Koha database '$arg->{dsn}'");
41 $self->{_dbh} = DBI->connect( $arg->{dsn}, $arg->{user}, $arg->{passwd}, { RaiseError => 1 } );
42 $self->{_sth} = $self->{_dbh}->prepare( $arg->{sql} );
43 $self->{_sth}->execute;
45 warn "got ", $self->{_sth}->rows, " rows for ", $arg->{sql};
47 open( $self->{_koha_fh}, '>', $arg->{path} ) || warn "not creating $arg->{path}: $!";
49 $self ? return $self : return undef;
54 Return record with ID C<$mfn> from database
56 my $rec = $input->fetch_rec( $mfn );
65 my $row = $self->{_sth}->fetchrow_hashref;
67 if ( my $fh = $self->{_koha_fh} ) {
68 my $marc = $row->{marc} || die "no marc?";
72 push @{$row->{'000'}}, $mfn;
78 Return number of records in database
80 my $size = $isis->size;
86 return $self->{_sth}->rows;
92 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
94 =head1 COPYRIGHT & LICENSE
96 Copyright 2009 Dobrica Pavlinusic, All Rights Reserved.
98 This program is free software; you can redistribute it and/or modify it
99 under the same terms as Perl itself.