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

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

revision 898 by dpavlin, Wed Oct 10 19:01:55 2007 UTC revision 899 by dpavlin, Wed Oct 10 19:01:57 2007 UTC
# Line 85  sub new { Line 85  sub new {
85    
86          $log->info("opening $format $version database '$arg->{path}'");          $log->info("opening $format $version database '$arg->{path}'");
87    
88            my $tag;
89            my $rec;
90    
91            while( $line = <$fh> ) {
92                    chomp($line);
93    
94                    my $v;
95    
96                    if ( $line =~ /^(\S\S)\s(.+)$/ ) {
97                                    $tag = $1;
98                                    $v = $2;
99                    } elsif ( $line =~ /^\s{3}(.+)$/ ) {
100                                    $v = $1;
101                    } elsif ( $line eq 'ER' ) {
102                            push @{ $self->{_rec} }, $rec;
103                            $rec = {};
104                            $line = <$fh>;
105                            chomp $line;
106                            $log->logdie("expected blank like in ",$arg->{path}, " +$.: $line") unless ( $line eq '' );
107                    } elsif ( $line eq 'EF' ) {
108                            last;
109                    } else {
110                            $log->logdie("can't parse +$. $arg->{path} : $line");
111                    }
112    
113                    push @{ $rec->{$tag} }, $v;
114    
115            }
116    
117            $log->debug("loaded ", $self->size, " records");
118    
119          $self ? return $self : return undef;          $self ? return $self : return undef;
120  }  }
121    
# Line 92  sub new { Line 123  sub new {
123    
124  Return record with ID C<$mfn> from database  Return record with ID C<$mfn> from database
125    
126    my $rec = $input->fetch_rec( $mfn, $filter_coderef);    my $rec = $input->fetch_rec( $mfn, $filter_coderef );
127    
128  =cut  =cut
129    
130  sub fetch_rec {  sub fetch_rec {
131          my $self = shift;          my $self = shift;
132    
133          my ($mfn, $filter_coderef) = @_;          my ( $mfn, $filter_coderef ) = @_;
   
         my $rec;  
134    
135          return $rec;          return $self->{_rec}->[$mfn-1];
136  }  }
137    
138    
# Line 117  Return number of records in database Line 146  Return number of records in database
146    
147  sub size {  sub size {
148          my $self = shift;          my $self = shift;
149          return 2;          return $#{$self->{_rec}} + 1;
150  }  }
151    
152  =head1 AUTHOR  =head1 AUTHOR

Legend:
Removed from v.898  
changed lines
  Added in v.899

  ViewVC Help
Powered by ViewVC 1.1.26