12 |
|
|
13 |
=head1 VERSION |
=head1 VERSION |
14 |
|
|
15 |
Version 0.00 |
Version 0.01 |
16 |
|
|
17 |
=cut |
=cut |
18 |
|
|
19 |
our $VERSION = '0.00'; |
our $VERSION = '0.01'; |
20 |
|
|
21 |
|
|
22 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
54 |
|
|
55 |
=cut |
=cut |
56 |
|
|
57 |
|
my $subfields = { |
58 |
|
'CR' => sub { |
59 |
|
my @v = split(/, /, shift); |
60 |
|
my $f; |
61 |
|
foreach ( qw/author year reference volume page/ ) { |
62 |
|
if ( my $tmp = shift @v ) { |
63 |
|
$f->{$_} = $tmp; |
64 |
|
} |
65 |
|
} |
66 |
|
if ( $f->{author} =~ /^\*(.+)/ ) { |
67 |
|
delete $f->{author}; |
68 |
|
$f->{institution} = $1; |
69 |
|
} |
70 |
|
return $f; |
71 |
|
}, |
72 |
|
}; |
73 |
|
|
74 |
sub new { |
sub new { |
75 |
my $class = shift; |
my $class = shift; |
76 |
my $self = {@_}; |
my $self = {@_}; |
116 |
} elsif ( $line =~ /^\s{3}(.+)$/ ) { |
} elsif ( $line =~ /^\s{3}(.+)$/ ) { |
117 |
$v = $1; |
$v = $1; |
118 |
} elsif ( $line eq 'ER' ) { |
} elsif ( $line eq 'ER' ) { |
119 |
|
# join tags |
120 |
|
foreach ( qw/AB/ ) { |
121 |
|
$rec->{$_} = join(' ', @{ $rec->{$_} }) if defined $rec->{$_}; |
122 |
|
} |
123 |
push @{ $self->{_rec} }, $rec; |
push @{ $self->{_rec} }, $rec; |
124 |
$rec = {}; |
$rec = {}; |
125 |
$line = <$fh>; |
$line = <$fh>; |
131 |
$log->logdie("can't parse +$. $arg->{path} : $line"); |
$log->logdie("can't parse +$. $arg->{path} : $line"); |
132 |
} |
} |
133 |
|
|
134 |
|
$v = $subfields->{$tag}->($v) if defined $subfields->{$tag}; |
135 |
|
|
136 |
push @{ $rec->{$tag} }, $v; |
push @{ $rec->{$tag} }, $v; |
137 |
|
|
138 |
} |
} |
175 |
=head1 SEE ALSO |
=head1 SEE ALSO |
176 |
|
|
177 |
L<http://isibasic.com/help/helpprn.html> is only sane source of document format which Google could find... |
L<http://isibasic.com/help/helpprn.html> is only sane source of document format which Google could find... |
178 |
|
|
179 |
=head1 AUTHOR |
=head1 AUTHOR |
180 |
|
|
181 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |