From 4cf681c88b58f4073dd657ed00ef50f6de9ce4da Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 18 Jul 2006 13:45:08 +0000 Subject: [PATCH] Fix handing of $state. Better logging. --- test-pod.pl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test-pod.pl b/test-pod.pl index aea63d9..f2b107b 100644 --- a/test-pod.pl +++ b/test-pod.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: test-pod.pl,v 1.8 2006-06-21 14:31:23 mike Exp $ +# $Id: test-pod.pl,v 1.9 2006-07-18 13:45:08 mike Exp $ # # Run like this: # YAZ_LOG=pod perl -I lib test-pod.pl "bagel.indexdata.com/gils" "bagel.indexdata.com/marc" @@ -40,12 +40,12 @@ sub got_record { my($conn, $arg, $rs, $event) = @_; my $host = $conn->option("host"); - my %state = $arg->{$host}; + my $state = $arg->{$host}; { # Sanity-checking assertions. These should be impossible - my $ns = $arg->{$host}->{next_to_show}; - my $nf = $arg->{$host}->{next_to_fetch}; + my $ns = $state->{next_to_show}; + my $nf = $state->{next_to_fetch}; if ($ns > $nf) { die "next_to_show > next_to_fetch ($ns > $nf)"; } elsif ($ns == $nf) { @@ -53,11 +53,11 @@ sub got_record { } } - my $i = $arg->{$host}->{next_to_show}++; + my $i = $state->{next_to_show}++; my $rec = $rs->record($i); print "$host: record $i is ", render_record($rec), "\n"; - request_records($conn, $rs, $arg->{$host}, 3) - if $i == $arg->{$host}->{next_to_fetch}-1; + request_records($conn, $rs, $state, 3) + if $i == $state->{next_to_fetch}-1; return 0; } @@ -72,7 +72,8 @@ sub request_records { my($conn, $rs, $state, $count) = @_; my $i = $state->{next_to_fetch}; - ZOOM::Log::log("appl", "requesting $count records from $i"); + ZOOM::Log::log("appl", "requesting $count records from $i for ", + $conn->option("host")); $rs->records($i, $count, 0); $state->{next_to_fetch} += $count; } -- 1.7.10.4