From: Dobrica Pavlinusic Date: Sat, 23 Oct 2010 11:56:34 +0000 (+0200) Subject: cleanup output X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=82f472fae030c4cc5e30c371c82918ad28fd9cd1;p=Biblio-Z3950.git cleanup output --- diff --git a/Aleph.pm b/Aleph.pm index 4c27f5a..d478aae 100644 --- a/Aleph.pm +++ b/Aleph.pm @@ -115,13 +115,13 @@ sub next_marc { my $mech = $self->{mech} || die "no mech?"; -print $mech->content; +#warn "## ", $mech->content; if ( $mech->content =~ m{Zapis\s+(\d+)}s ) { my $nr = $1; -diag "parse $nr"; +warn "parse $nr"; $marc = MARC::Record->new; $hash = {}; @@ -131,19 +131,19 @@ diag "parse $nr"; sub field { my ( $f, $v ) = @_; $v =~ s/\Q \E/ /gs; -warn "# $f\t$v\n"; +#warn "## $f\t$v\n"; $hash->{$f} = $v; my ($i1,$i2) = (' ',' '); ($i1,$i2) = ($2,$3) if $f =~ s/^(...)(.)?(.)?/$1/; my @sf = split(/\|/, $v); shift @sf; @sf = map { s/^(\w)\s+//; { $1 => $_ } } @sf; -diag "sf = ", dump(@sf); +#warn "## sf = ", dump(@sf); $marc->add_fields( $f, $i1, $i2, @sf ) if $f =~ m/^\d+$/; } $html =~ s|\s*]*>(.+?)\s*(.+?)|field($1,$2)|ges; - diag "# hash ",dump($hash); +# diag "# hash ",dump($hash); my $id = $hash->{SYS} || die "no SYS"; diff --git a/t/2-Aleph.t b/t/2-Aleph.t index e14d48e..aeb20a2 100755 --- a/t/2-Aleph.t +++ b/t/2-Aleph.t @@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 4; +use Test::More tests => 6; use_ok 'Aleph'; @@ -12,5 +12,9 @@ ok( my $o = Aleph->new, 'new' ); ok( my $hits = $o->search( 'WTI=linux' ), 'search' ); diag "$hits results"; -ok( my $marc = $o->next_marc, 'next_marc' ); +foreach ( 1 .. 3 ) { + +ok( my $marc = $o->next_marc, "next_marc $_" ); diag $marc; + +}