20 |
=cut |
=cut |
21 |
|
|
22 |
our $VERSION = '0.01'; |
our $VERSION = '0.01'; |
23 |
|
our $debug = 0; |
24 |
|
|
25 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
26 |
|
|
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 |
} |
} |