Bug 7768 - acqui/z3950_search.pl: remove sub displayresults to fix plack scoping
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
d5542514d2
commit
ccce4f0f60
1 changed files with 20 additions and 21 deletions
|
@ -64,7 +64,6 @@ my $op = $input->param('op');
|
||||||
my $booksellerid = $input->param('booksellerid');
|
my $booksellerid = $input->param('booksellerid');
|
||||||
my $basketno = $input->param('basketno');
|
my $basketno = $input->param('basketno');
|
||||||
my $noconnection;
|
my $noconnection;
|
||||||
my $numberpending;
|
|
||||||
my $attr = '';
|
my $attr = '';
|
||||||
my $term;
|
my $term;
|
||||||
my $host;
|
my $host;
|
||||||
|
@ -88,7 +87,7 @@ unless ($random)
|
||||||
$random = rand(1000000000);
|
$random = rand(1000000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $DEBUG = 0; # if set to 1, many debug message are send on syslog.
|
my $DEBUG = $ENV{DEBUG} || 0; # if set to 1, many debug message are send on syslog.
|
||||||
|
|
||||||
# get framework list
|
# get framework list
|
||||||
my $frameworks = getframeworks;
|
my $frameworks = getframeworks;
|
||||||
|
@ -131,11 +130,12 @@ if ( $op ne "do_search" ) {
|
||||||
biblionumber => $biblionumber,
|
biblionumber => $biblionumber,
|
||||||
);
|
);
|
||||||
output_html_with_http_headers $input, $cookie, $template->output;
|
output_html_with_http_headers $input, $cookie, $template->output;
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
my @id = $input->param('id');
|
my @id = $input->param('id');
|
||||||
|
|
||||||
if ( not defined @id ) {
|
if ( not @id ) {
|
||||||
# empty server list -> report and exit
|
# empty server list -> report and exit
|
||||||
$template->param( emptyserverlist => 1 );
|
$template->param( emptyserverlist => 1 );
|
||||||
output_html_with_http_headers $input, $cookie, $template->output;
|
output_html_with_http_headers $input, $cookie, $template->output;
|
||||||
|
@ -228,7 +228,10 @@ warn "query ".$query if $DEBUG;
|
||||||
# $oResult[$z] = $oConnection[$z]->search_pqf($query);
|
# $oResult[$z] = $oConnection[$z]->search_pqf($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub displayresults {
|
warn "# nremaining = $nremaining\n" if $DEBUG;
|
||||||
|
|
||||||
|
while ( $nremaining-- ) {
|
||||||
|
|
||||||
my $k;
|
my $k;
|
||||||
my $event;
|
my $event;
|
||||||
while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) {
|
while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) {
|
||||||
|
@ -241,7 +244,7 @@ sub displayresults {
|
||||||
|
|
||||||
if ( $k != 0 ) {
|
if ( $k != 0 ) {
|
||||||
$k--;
|
$k--;
|
||||||
warn $serverhost[$k] if $DEBUG;
|
warn "event from $k server = ",$serverhost[$k] if $DEBUG;
|
||||||
my ( $error, $errmsg, $addinfo, $diagset ) =
|
my ( $error, $errmsg, $addinfo, $diagset ) =
|
||||||
$oConnection[$k]->error_x();
|
$oConnection[$k]->error_x();
|
||||||
if ($error) {
|
if ($error) {
|
||||||
|
@ -252,6 +255,7 @@ sub displayresults {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $numresults = $oResult[$k]->size();
|
my $numresults = $oResult[$k]->size();
|
||||||
|
warn "numresults = $numresults" if $DEBUG;
|
||||||
my $i;
|
my $i;
|
||||||
my $result = '';
|
my $result = '';
|
||||||
if ( $numresults > 0 ) {
|
if ( $numresults > 0 ) {
|
||||||
|
@ -305,20 +309,15 @@ sub displayresults {
|
||||||
} #$numresults
|
} #$numresults
|
||||||
}
|
}
|
||||||
} # if $k !=0
|
} # if $k !=0
|
||||||
$numberpending = $nremaining - 1;
|
|
||||||
$template->param(
|
|
||||||
breeding_loop => \@breeding_loop,
|
|
||||||
server => $servername[$k],
|
|
||||||
numberpending => $numberpending,
|
|
||||||
errconn => \@errconn
|
|
||||||
);
|
|
||||||
output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0;
|
|
||||||
|
|
||||||
# print $template->output if $firstresult !=1;
|
# print $template->output if $firstresult !=1;
|
||||||
$firstresult++;
|
$firstresult++;
|
||||||
}
|
|
||||||
displayresults();
|
} # while nremaining
|
||||||
while ( --$nremaining > 0 ) {
|
|
||||||
displayresults();
|
$template->param(
|
||||||
}
|
breeding_loop => \@breeding_loop,
|
||||||
} ## if op=search
|
#server => $servername[$k],
|
||||||
|
numberpending => $nremaining > 0 ? $nremaining : 0,
|
||||||
|
errconn => \@errconn
|
||||||
|
);
|
||||||
|
output_html_with_http_headers $input, $cookie, $template->output;
|
||||||
|
|
Loading…
Reference in a new issue