Re: First feature patch for plperl - draft [PATCH]
Tim Bunce <tim.bunce@pobox.com>
From: Tim Bunce <Tim.Bunce@pobox.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeff <threshar@threshar.is-a-geek.com>, Tim Bunce <Tim.Bunce@pobox.com>, "David E. Wheeler" <david@kineticode.com>, pgsql-hackers@postgresql.org
Date: 2009-12-04T19:16:36Z
Lists: pgsql-hackers
On Fri, Dec 04, 2009 at 11:01:42AM -0500, Tom Lane wrote: > Jeff <threshar@threshar.is-a-geek.com> writes: > > Is there any possible way to enable "use strict;" for plperl (trusted) > > modules? > > The plperl manual shows a way to do it using some weird syntax or > other. It'd sure be nice to be able to use the regular syntax though. Finding a solution is definitely on my list. I've spent a little time exploring this already but haven't found a simple solution yet. The neatest would have been overriding &CORE::GLOBAL::require but sadly the Safe/Opcode mechanism takes priority over that and forbids compiling code that does a use/require. I may end up re-enabling the require opcode but redirecting it to run some C code in plperl.c (the same 'opcode redirection' technique used by my NYTProf profiler). That C code would only need to throw an exception if the module hasn't been loaded already. Tim.