Re: Curious plperl behavior

From: Richard Huxton <dev(at)archonet(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff <threshar(at)threshar(dot)is-a-geek(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Curious plperl behavior
Date: 2010-02-24 21:21:43
Message-ID: 4B859867.2070106@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 24/02/10 20:55, Tom Lane wrote:
> Jeff<threshar(at)threshar(dot)is-a-geek(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-02-24 21:34:11 Re: Curious plperl behavior
Previous Message Tom Lane 2010-02-24 20:55:50 Re: Curious plperl behavior