Re: exception handling in plperlu

Поиск
Список
Период
Сортировка
От Douglas McNaught
Тема Re: exception handling in plperlu
Дата
Msg-id 87hcsl43qq.fsf@suzuka.mcnaught.org
обсуждение исходный текст
Ответ на Re: exception handling in plperlu  ("Jasbinder Singh Bali" <jsbali@gmail.com>)
Ответы Re: exception handling in plperlu  (merlyn@stonehenge.com (Randal L. Schwartz))
Список pgsql-general
"Jasbinder Singh Bali" <jsbali@gmail.com> writes:

> just wondeng why doesn't it let me put
> my $dbh=DBI->connect("dbi:Pg:dbname=dbunmask; host=192.168.0.120; port=5432;",
> "", "");
> in eval
>
> says
> Global symbol "$dbh" requires explicit package name at line <where ever dbh is
> used>

The my() variable goes out of scope when the eval {} is done.  Declare
the variable outside the eval {}:

my $dbh;

eval { $dbh = connect(...) };

eval { $dbh->prepare(...:) };

-Doug

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: exception handling in plperlu
Следующее
От: Tony Caduto
Дата:
Сообщение: Re: pg_dumpall and version confusion