Re: Error handling in plperl and pltcl - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Error handling in plperl and pltcl
Date
Msg-id 41ACA3C4.8030802@dunslane.net
Whole thread Raw
In response to Re: Error handling in plperl and pltcl  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:

>
>In the case of Perl I suspect it is reasonably possible to determine
>whether there is an "eval" surrounding the call or not, although we
>might have to get more friendly with Perl's internal data structures
>than a purist would like.  
>  
>

Not really very hard. (caller(0))[3] should have the value "(eval)" if 
you are in an eval. There might also be some ways of getting this via 
the perlguts API although I'm not aware of it. Of course, if you're in a 
subroutine which is in turn called from an eval things get trickier, so 
we might have to walk the stack frames a bit.

cheers

andrew


pgsql-hackers by date:

Previous
From: Mark Wong
Date:
Subject: Re: 8.0beta5 results w/ dbt2
Next
From: Mark Wong
Date:
Subject: Re: 8.0beta5 results w/ dbt2