Search Postgresql Archives

Re: pl/perl and recent perl versions - failing to load internal modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 1, 2014 at 7:31 PM, Alex Hunsaker <badalex@xxxxxxxxx> wrote:
> On Tue, Jul 1, 2014 at 6:39 PM, Toby Corkindale
> <toby.corkindale@xxxxxxxxxxxxxxxxxxxx> wrote:
>> Hi Alex,

>> However the following code fails:
>> =>  do $$ "\N{U+263A}" =~ /[[:punct:]]/$$ language plperl;
>> ERROR:  Unable to load utf8.pm into plperl at line 1.
>> BEGIN failed--compilation aborted.
>> CONTEXT:  PL/Perl anonymous code block

> One thing you might try is plperl.on_plperl_init = "require
> 'utf8_heavy.pl'; require unicore/Heavy.pl'; or maybe just
> plperl.on_plperl_init = 'use Unicode::UCD;'

If you are up to recompiling postgres, you might try this patch. Its
untested, but the basic idea is to always allow require 'utf8.pm' to
work in plperl. Near as I can tell utf8.pm is a strange package, when
we look to see if we already have it loaded it, we can't find it for
example. Which would explain why plperl.on_init = ' use utf8;' does
not work for you. I don't have the time to dig through a bunch of perl
versions to find out whats going on with utf8.pm.

I suspect this will make it fail on loading a different module (my gut
says utf8 is going to want to load unicore stuff once its loaded) but
it would be interesting to see nonetheless.
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 2f7a12f..62cf116 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -881,6 +881,17 @@ pp_require_safe(pTHX)
 	if (svp && *svp != &PL_sv_undef)
 		RETPUSHYES;
 
+	/*
+	 * whitelist utf8.pm, perl 5.18 and maybe others needs to try and load this
+	 * probably for unicode/unicore stuff
+	 */
+	if (strncmp("utf8.pm", name, len) == 0) {
+		PUSHMARK(SP);
+		PUSHs(sv);
+		PUTBACK;
+		return pp_require_orig(aTHX);
+	}
+
 	DIE(aTHX_ "Unable to load %s into plperl", name);
 
 	/*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux