From 853d05751de1ecd197799ffd362e8653e9bdbc92 Mon Sep 17 00:00:00 2001 From: dpavlin Date: Sat, 20 Jun 2009 20:19:49 +0000 Subject: [PATCH] cleanup output git-svn-id: svn+ssh://llin.lib/home/dpavlin/private/svn/Z3950-HTML-Scraper@7 ae73d1a6-5fa4-44a9-8f13-f281fb455051 --- COBISS.pm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/COBISS.pm b/COBISS.pm index 602a268..d7628b5 100644 --- a/COBISS.pm +++ b/COBISS.pm @@ -76,19 +76,19 @@ sub search { my $url = 'http://cobiss.izum.si/scripts/cobiss?ukaz=GETID&lani=en'; -diag "# get $url"; +diag "get $url"; $mech->get( $url ); -diag "# got session"; +diag "got session"; $mech->follow_link( text_regex => qr/union/ ); -diag "# switch to advanced form (select)"; +diag "switch to advanced form (select)"; $mech->follow_link( url_regex => qr/mode=3/ ); -diag "# submit search $query"; +diag "submit search $query"; $mech->submit_form( fields => { @@ -104,11 +104,11 @@ diag "# submit search $query"; return; } -diag "# got $hits results, get first one"; +diag "got $hits results, get first one"; $mech->follow_link( url_regex => qr/ukaz=DISP/ ); -diag "# in COMARC format"; +diag "in COMARC format"; $mech->follow_link( url_regex => qr/fmt=13/ ); } @@ -125,7 +125,7 @@ sub fetch_marc { my $nr = $2; my $id = $3; -diag "# fetch_marc $nr [$id]"; +diag "fetch_marc $nr [$id]"; $comarc =~ s{}{}gs; $comarc =~ s{]*>}{}gs; @@ -138,17 +138,16 @@ diag "# fetch_marc $nr [$id]"; my $marc = MARC::Record->new; foreach my $line ( split(/[\r\n]+/, $comarc) ) { - our @f; if ( $line !~ s{^(\d\d\d)([01 ])([01 ])}{} ) { diag "SKIP: $line"; } else { $line .= ""; - @f = ( $1, $2, $3 ); + our @f = ( $1, $2, $3 ); sub sf { push @f, @_; } $line =~ s{(\w)([^<]+)\s*}{sf($1, $2)}ges; - diag "# f:", join('|', @f), " left: |$line|"; + diag "f:", join('|', @f), " left: |$line|"; $marc->add_fields( @f ); } } -- 2.20.1