Propagate the results out of the 'row' function correctly again -- the wantarray context isn't maintained inside a try block, unfortunately

This commit is contained in:
ian%hixie.ch 2002-12-28 03:27:23 +00:00
Родитель c30ca82777
Коммит ac03050fbd
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -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 {