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

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

revision 761 by dpavlin, Wed Oct 25 17:10:08 2006 UTC revision 771 by dpavlin, Fri Nov 3 20:40:33 2006 UTC
# Line 7  use blib; Line 7  use blib;
7    
8  use WebPAC::Common;  use WebPAC::Common;
9  use base qw/WebPAC::Common/;  use base qw/WebPAC::Common/;
10  use Data::Dumper;  use Data::Dump qw/dump/;
11  use Encode qw/from_to/;  use Encode qw/from_to/;
12    
13  =head1 NAME  =head1 NAME
# Line 16  WebPAC::Input - read different file form Line 16  WebPAC::Input - read different file form
16    
17  =head1 VERSION  =head1 VERSION
18    
19  Version 0.14  Version 0.15
20    
21  =cut  =cut
22    
23  our $VERSION = '0.14';  our $VERSION = '0.15';
24    
25  =head1 SYNOPSIS  =head1 SYNOPSIS
26    
# Line 102  sub new { Line 102  sub new {
102    
103          require $module_path;          require $module_path;
104    
         # check if required subclasses are implemented  
         foreach my $subclass (qw/open_db fetch_rec init dump_rec/) {  
                 # FIXME  
         }  
   
105          $self->{'encoding'} ||= 'ISO-8859-2';          $self->{'encoding'} ||= 'ISO-8859-2';
106    
107          $self ? return $self : return undef;          $self ? return $self : return undef;
# Line 229  sub open { Line 224  sub open {
224                  $log->debug("using modify_file $p");                  $log->debug("using modify_file $p");
225                  $rec_regex = $self->modify_file_regexps( $p );                  $rec_regex = $self->modify_file_regexps( $p );
226          } elsif (my $h = $arg->{modify_records}) {          } elsif (my $h = $arg->{modify_records}) {
227                  $log->debug("using modify_records ", Dumper( $h ));                  $log->debug("using modify_records ", sub { dump( $h ) });
228                  $rec_regex = $self->modify_record_regexps(%{ $h });                  $rec_regex = $self->modify_record_regexps(%{ $h });
229          }          }
230          $log->debug("rec_regex: ", Dumper($rec_regex)) if ($rec_regex);          $log->debug("rec_regex: ", sub { dump($rec_regex) }) if ($rec_regex);
231    
232          my $class = $self->{module} || $log->logconfess("can't get low-level module name!");          my $class = $self->{module} || $log->logconfess("can't get low-level module name!");
233    
# Line 315  sub open { Line 310  sub open {
310                                  return $l;                                  return $l;
311                  });                  });
312    
313                  $log->debug(sub { Dumper($rec) });                  $log->debug(sub { dump($rec) });
314    
315                  if (! $rec) {                  if (! $rec) {
316                          $log->warn("record $pos empty? skipping...");                          $log->warn("record $pos empty? skipping...");
# Line 535  sub stats { Line 530  sub stats {
530                  } sort { $a cmp $b } keys %{ $s->{fld} }                  } sort { $a cmp $b } keys %{ $s->{fld} }
531          );          );
532    
533          $log->debug( sub { Dumper($s) } );          $log->debug( sub { dump($s) } );
534    
535          return $out;          return $out;
536  }  }
# Line 549  Display humanly readable dump of record Line 544  Display humanly readable dump of record
544  sub dump {  sub dump {
545          my $self = shift;          my $self = shift;
546    
547          return $self->{ll_db}->dump_rec( $self->{pos} );          return unless $self->{ll_db};
548    
549            if ($self->{ll_db}->can('dump_rec')) {
550                    return $self->{ll_db}->dump_rec( $self->{pos} );
551            } else {
552                    return dump( $self->{ll_db}->fetch_rec( $self->{pos} ) );
553            }
554  }  }
555    
556  =head2 modify_record_regexps  =head2 modify_record_regexps

Legend:
Removed from v.761  
changed lines
  Added in v.771

  ViewVC Help
Powered by ViewVC 1.1.26