From ac03050fbd20fcf361955014e78550590adf4cf1 Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Sat, 28 Dec 2002 03:27:23 +0000 Subject: [PATCH] Propagate the results out of the 'row' function correctly again -- the wantarray context isn't maintained inside a try block, unfortunately --- webtools/PLIF/PLIF/Database/ResultsFrame/DBI.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webtools/PLIF/PLIF/Database/ResultsFrame/DBI.pm b/webtools/PLIF/PLIF/Database/ResultsFrame/DBI.pm index 91798a6a8b6..c6b3ea9b89a 100644 --- a/webtools/PLIF/PLIF/Database/ResultsFrame/DBI.pm +++ b/webtools/PLIF/PLIF/Database/ResultsFrame/DBI.pm @@ -59,8 +59,9 @@ sub rowsAffected { sub row { my $self = shift; $self->assert($self->executed, 1, 'Tried to fetch data from an unexecuted statement'); + my $wantarray = wantarray; # to propagate it into the try block below my @result = try { - if (wantarray) { + if ($wantarray) { return $self->handle->fetchrow_array(); } else { my $array = $self->handle->fetchrow_arrayref(); @@ -84,7 +85,7 @@ sub row { raise $exception; } }; - return @result; + return $wantarray ? @result : $result[0]; } sub rows {