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

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

revision 1126 by dpavlin, Mon Apr 20 13:44:40 2009 UTC revision 1130 by dpavlin, Tue Apr 21 21:06:29 2009 UTC
# Line 20  Version 0.01 Line 20  Version 0.01
20  =cut  =cut
21    
22  our $VERSION = '0.01';  our $VERSION = '0.01';
23    our $debug = 0;
24    
25  =head1 SYNOPSIS  =head1 SYNOPSIS
26    
# Line 79  sub new { Line 80  sub new {
80                  $line =~ s{[\r\n]+$}{};                  $line =~ s{[\r\n]+$}{};
81                  next if $line eq '';                  next if $line eq '';
82    
83                  warn "<< $line\n";                  warn "<< $line\n" if $debug;
84    
85                  if ( $line =~ m/^<(\d+)>$/ ) {                  if ( $line =~ m/^<(\d+)>$/ ) {
86                          push @{ $self->{_rec} }, $rec if $rec;                          push @{ $self->{_rec} }, $rec if $rec;
87                          warn "## rec = ",dump( $rec ),$/;                          warn "## rec = ",dump( $rec ),$/ if $debug;
88                          my $expect_rec = $#{ $self->{_rec} } + 2;                          my $expect_rec = $#{ $self->{_rec} } + 2;
89                          warn "wrong Ovid record number: $1 != $expect_rec" unless $1 == $expect_rec;                          warn "wrong Ovid record number: $1 != $expect_rec" if $debug && $1 != $expect_rec;
90                          $rec = { '000' => [ $1 ] };                          $rec = { '000' => [ $1 ] };
91                  } elsif ( $line =~ /^(\w.+)/ ) {                  } elsif ( $line =~ /^(\w.+)/ ) {
92                          $tag = $1;                          $tag = $1;
93                          warn "++ $tag\n";                          warn "++ $tag\n" if $debug;
94                  } elsif ( $line =~ /^\s\s(.+)/ ) {                  } elsif ( $line =~ /^\s\s(.+)/ ) {
95                          my $v = $1;                          my $v = $1;
96                          $v =~ s{[\s\.]+$}{};                          $v =~ s{[\s\.]+$}{};
97                          $rec->{$tag} = [ $v ];                          $rec->{$tag} = [ $v ];
98                  } else {                  } else {
99                          warn "### skip: '$line'\n";                          warn "### skip: '$line'\n" if $debug;
100                  }                  }
101    
102          }          }

Legend:
Removed from v.1126  
changed lines
  Added in v.1130

  ViewVC Help
Powered by ViewVC 1.1.26