Re: Curious plperl behavior - Mailing list pgsql-general

From Richard Huxton
Subject Re: Curious plperl behavior
Date
Msg-id 4B859867.2070106@archonet.com
Whole thread Raw
In response to Re: Curious plperl behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Curious plperl behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 24/02/10 20:55, Tom Lane wrote:
> Jeff<threshar@threshar.is-a-geek.com>  writes:
>> [ oracular excerpt from perlref ]
>
> So is this just a dark corner of Perl, or is plperl doing something to
> help you get confused?  In particular, do we need to add anything to
> the plperl documentation?  We're not trying to explain Perl to people,
> but if plperl is doing something that contributes to this, maybe it
> requires documentation.

It is documented.

http://www.postgresql.org/docs/8.4/static/plperl-funcs.html

     Note:  The use of named nested subroutines is dangerous in Perl,
especially if they refer to lexical variables in the enclosing scope.
Because a PL/Perl function is wrapped in a subroutine, any named
subroutine you create will be nested. In general, it is far safer to
create anonymous subroutines which you call via a coderef. See the
perldiag man page for more details.


There's two ways to read that:
1. "Dangerous in Perl" - well, what isn't?
2. "Dangerous in Perl" - blimey, if they think it's dangerous, it must
make lion-wrestling safe.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Curious plperl behavior
Next
From: Tom Lane
Date:
Subject: Re: Curious plperl behavior