Thread: plperl and the dynamic loader

plperl and the dynamic loader

From
"Ragnar Hakonarson"
Date:
Hi,

I have now desperately tried to use the 'use' keyword within my plperl
scripts without success.

Does plperl not load libraries dynamically?

I am trying to import a .pm module from plperl and I get the following error
message:creation of function failed : require trapped by operation mask at (eval
28) line 2.

What I want to be able to do is to access my own defined perl libraries from
plperl.

I have looked at the plperl.c file and I noticed that the dynamic loader is
not initialised.

I would be most grateful for any help. Also, is there any documentation
online for plperl?

Regards,
Ragnar




Re: plperl and the dynamic loader

From
Tom Lane
Date:
"Ragnar Hakonarson" <rhakonarson@conquestnetwork.com> writes:
> Does plperl not load libraries dynamically?

> I am trying to import a .pm module from plperl and I get the following error
> message:
>     creation of function failed : require trapped by operation mask at (eval 28) line 2.

Makes sense to me.  plperl runs in a "safe" Perl interpreter, and if you
could load arbitrary perl code then the safety would be bypassed.

The reason for this restriction is that whatever the Perl code does will
be done with the permissions of the Postgres user (since it's running in
a Postgres-owned backend).  It'd be a huge security hole if users could
invoke arbitrary Perl code in that environment.  So, we only permit
"safe" operations.

If you like living dangerously you could weaken the protection to suit
your taste --- read about the Safe and Opcode perl modules, and then
twiddle the plperl source code to select whatever operator mask you
feel comfortable with.
        regards, tom lane


RE: plperl and the dynamic loader

From
"Ragnar Hakonarson"
Date:
Hi Tom,

Thanks for you help.

I have not got a great deal of experience with C.

Could you be so kind to tell me how I directly link the DynaLoader into
plperl.so.

Once I got the DynaLoader in place my task is complete.

You might wonder what I am doing. I am implementing a function in Postures
that will act as a stored procedure over ODBC. I need to connect to many
databases from the stored procedure and I also need to connect to my own
perl .pm modules.

Regards,
Ragnar

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 21 May 2000 20:36
To: Ragnar Hakonarson
Subject: Re: [HACKERS] plperl and the dynamic loader


"Ragnar Hakonarson" <rhakonarson@conquestnetwork.com> writes:
> I get the following error from the backend:
>     Load of file /..../plperl.so: undefined symbol: boot_DynaLoader

> What else do I have to do to enable this?

IIRC, DynaLoader is a static library not dynamic, so you might have to
link it directly into plperl.so.  Not sure about that.  I recall that
Mark Hollomon and I had some troubles getting plperl to build portably
when it itself depended on DynaLoader, so he rewrote it to avoid needing
DynaLoader ...
        regards, tom lane