projects
/
Biblio-Z3950.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
caf54aa
)
cleanup field extraction
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 23 Oct 2010 11:31:36 +0000
(13:31 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 23 Oct 2010 11:31:36 +0000
(13:31 +0200)
Aleph.pm
patch
|
blob
|
history
diff --git
a/Aleph.pm
b/Aleph.pm
index
0ed5481
..
4e25c57
100644
(file)
--- a/
Aleph.pm
+++ b/
Aleph.pm
@@
-106,9
+106,13
@@
diag "in MARC format";
}
}
+our ( $hash, $marc );
+
sub next_marc {
my ($self,$format) = @_;
sub next_marc {
my ($self,$format) = @_;
+ $format ||= 'marc';
+
my $mech = $self->{mech} || die "no mech?";
print $mech->content;
my $mech = $self->{mech} || die "no mech?";
print $mech->content;
@@
-119,10
+123,10
@@
print $mech->content;
diag "parse $nr";
diag "parse $nr";
- my $marc = MARC::Record->new;
+ $marc = MARC::Record->new;
+ $hash = {};
my $html = $mech->content;
my $html = $mech->content;
- my $hash;
sub field {
my ( $f, $v ) = @_;
sub field {
my ( $f, $v ) = @_;
@@
-139,13
+143,13
@@
diag "sf = ", dump(@sf);
}
$html =~ s|<tr>\s*<td class=td1 id=bold[^>]*>(.+?)</td>\s*<td class=td1>(.+?)</td>|field($1,$2)|ges;
}
$html =~ s|<tr>\s*<td class=td1 id=bold[^>]*>(.+?)</td>\s*<td class=td1>(.+?)</td>|field($1,$2)|ges;
- diag dump($hash);
+ diag
"# hash ",
dump($hash);
my $id = $hash->{SYS} || die "no SYS";
my $path = "marc/$id.$format";
my $id = $hash->{SYS} || die "no SYS";
my $path = "marc/$id.$format";
- open(my $out, '>:utf8', $path);
+ open(my $out, '>:utf8', $path)
|| die "$path: $!"
;
print $out $marc->as_usmarc;
close($out);
print $out $marc->as_usmarc;
close($out);