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

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

revision 1324 by dpavlin, Wed Aug 19 16:07:39 2009 UTC revision 1325 by dpavlin, Tue Feb 2 18:03:17 2010 UTC
# Line 15  WebPAC::Input::Koha - read MARC records Line 15  WebPAC::Input::Koha - read MARC records
15    
16  =cut  =cut
17    
18  our $VERSION = '0.01';  our $VERSION = '0.02';
19    
20  =head1 FUNCTIONS  =head1 FUNCTIONS
21    
22  =head2 new  =head2 new
23    
24    my $input = new WebPAC::Input::Koha(    my $input = new WebPAC::Input::Koha(
25          dsn => '',          dsn    => 'dbi:mysql:database=koha',
26          filter => \&code_ref,          user   => $ENV{KOHA_USER},
27            passwd => $ENV{KOHA_PASSWD},
28    }    }
29    
30  =cut  =cut
# Line 36  sub new { Line 37  sub new {
37          my $arg = {@_};          my $arg = {@_};
38    
39          my $log = $self->_get_logger();          my $log = $self->_get_logger();
40            $log->debug( 'arg = ', dump($arg) );
41    
42          if ( -e $arg->{path} ) {          if ( -e $arg->{path} ) {
43                  $log->info("Koha marc dump ", $arg->{path}, " exists");                  $log->info("Koha marc dump ", $arg->{path}, " exists");
# Line 45  sub new { Line 47  sub new {
47                  $arg->{dsn}    ||= 'dbi:mysql:database=koha';                  $arg->{dsn}    ||= 'dbi:mysql:database=koha';
48                  $arg->{user}   ||= $ENV{KOHA_USER};                  $arg->{user}   ||= $ENV{KOHA_USER};
49                  $arg->{passwd} ||= $ENV{KOHA_PASSWD},                  $arg->{passwd} ||= $ENV{KOHA_PASSWD},
50                  $arg->{sql}    ||= 'select biblioitemnumber as mfn, marc from biblioitems';                  $arg->{sql}    ||= 'select biblionumber as mfn, marc from biblioitems';
51                    $arg->{sql}    .= ' limit ' . $arg->{limit} if $arg->{limit};
52                    $arg->{sql}    .= ' offset ' . $arg->{offset} if $arg->{offset};
53    
54                  $log->info("opening Koha database '$arg->{dsn}'");                  $log->info("opening Koha database '$arg->{dsn}'");
55    
# Line 100  Return number of records in database Line 104  Return number of records in database
104    
105  sub size {  sub size {
106          my $self = shift;          my $self = shift;
107          return $self->{_koha_size};          return $self->{_koha_size} + $self->{offset};
108  }  }
109    
110    

Legend:
Removed from v.1324  
changed lines
  Added in v.1325

  ViewVC Help
Powered by ViewVC 1.1.26