Re: PL/Perl regression tests with use_strict

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: PL/Perl regression tests with use_strict
Дата
Msg-id 20050824053726.GA34097@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: PL/Perl regression tests with use_strict  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: PL/Perl regression tests with use_strict  ("Andrew Dunstan" <andrew@dunslane.net>)
Список pgsql-patches
On Tue, Aug 23, 2005 at 10:30:51PM -0600, Michael Fuhr wrote:
> Global symbol "$x" requires explicit package name at (eval 3) line 1.
>
> If I'm reading the Perl source code correctly (pp_ctl.c), the number
> following "eval" comes from a variable named PL_evalseq that's
> incremented each time it appears in one of these messages.  It looks
> like we'd have to munge the error message to get rid of that.

Hmmm...tests suggest that we might be able to munge $@ in the
mk*safefunc functions.  That is, instead of doing

  return eval($stuff);

we might be able to do

  my $retval = eval($stuff);
  $@ =~ s/ \(eval \d+\) / /g if $@;
  return $retval;

That would convert messages like

  Global symbol "$x" requires explicit package name at (eval 3) line 1.

into

  Global symbol "$x" requires explicit package name at line 1.

Is that what you're looking for?  So far I've done only simple tests
in standalone embedded Perl programs, so I don't know if this approach
would work in PL/Perl or have unintended effects.

--
Michael Fuhr

В списке pgsql-patches по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: PL/Perl regression tests with use_strict
Следующее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: PL/Perl regression tests with use_strict