Re: exception handling in plperlu

From: "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net>
To: "'Jasbinder Singh Bali'" <jsbali(at)gmail(dot)com>, "'Martijn van Oosterhout'" <kleptog(at)svana(dot)org>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: exception handling in plperlu
Date: 2007-03-16 15:06:28
Message-ID: 03d101c767dc$ac9c9f00$6400a8c0@dualcore
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You'll want something like this:

my $dbh = eval { DBI->connect(....);};

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Jasbinder Singh
Bali
Sent: Friday, March 16, 2007 9:55 AM
To: Martijn van Oosterhout; Tom Lane; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] exception handling in plperlu

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>

Jas

On 3/16/07, Martijn van Oosterhout < kleptog(at)svana(dot)org> wrote:

On Thu, Mar 15, 2007 at 10:06:06PM -0400, Jasbinder Singh Bali wrote:
> How about using a try catch block?
> isn't that more efficient that eval?

Umm, eval is perl's equivalent of try/catch. There is no other way.

Have a nice day,
--
Martijn van Oosterhout < kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> From each according to his ability. To each according to his ability
to litigate.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF+oqkIB7bNG8LQkwRApyEAJ413cmp0bIuasEceWhXgTgSE6NOFACeNijH
ZHknBQrtHqg30xL8Wh219Ik=
=Xhhm
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-03-16 15:08:56 Re: exception handling in plperlu
Previous Message A.M. 2007-03-16 15:05:41 Re: exception handling in plperlu