);
my $hits = 0;
- if ( $mech->content =~ m{ukupno\s+(\d+).*(do\s+(\d+))}s ) {
+ if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)}s ) {
$hits = $1;
$hits = $2 if $2 && $2 < $1; # correct for max. results
} else {
}
+our ( $hash, $marc );
+
sub next_marc {
my ($self,$format) = @_;
+ $format ||= 'marc';
+
my $mech = $self->{mech} || die "no mech?";
print $mech->content;
diag "parse $nr";
- my $marc = MARC::Record->new;
+ $marc = MARC::Record->new;
+ $hash = {};
my $html = $mech->content;
- my $hash;
sub field {
my ( $f, $v ) = @_;
}
$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";
- open(my $out, '>:utf8', $path);
+ open(my $out, '>:utf8', $path) || die "$path: $!";
print $out $marc->as_usmarc;
close($out);
diag "created $path ", -s $path, " bytes";
- diag $marc->as_formatted;
+# diag $marc->as_formatted;
$nr++;