Tidy up and refactor plperl.c.
Andrew Dunstan <andrew@dunslane.net>
Tidy up and refactor plperl.c.
- Changed MULTIPLICITY check from runtime to compiletime.
No loads the large Config module.
- Changed plperl_init_interp() to return new interp
and not alter the global interp_state
- Moved plperl_safe_init() call into check_interp().
- Removed plperl_safe_init_done state variable
as interp_state now covers that role.
- Changed plperl_create_sub() to take a plperl_proc_desc argument.
- Simplified return value handling in plperl_create_sub.
- Changed perl.com link in the docs to perl.org and tweaked
wording to clarify that require, not use, is what's blocked.
- Moved perl code in large multi-line C string literal macros
out to plc_*.pl files.
- Added a test2macro.pl utility to convert the plc_*.pl files to
macros in a perlchunks.h file which is #included
- Simplifed plperl_safe_init() slightly
- Optimized pg_verifymbstr calls to avoid unneeded strlen()s.
Patch from Tim Bunce, with minor editing from me.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/plperl.sgml | modified | +4 −3 |
| src/pl/plperl/GNUmakefile | modified | +7 −2 |
| src/pl/plperl/plc_perlboot.pl | added | +50 −0 |
| src/pl/plperl/plc_safe_bad.pl | added | +15 −0 |
| src/pl/plperl/plc_safe_ok.pl | added | +33 −0 |
| src/pl/plperl/plperl.c | modified | +95 −196 |
| src/pl/plperl/sql/plperl.sql | modified | +1 −0 |
| src/pl/plperl/text2macro.pl | added | +98 −0 |