Search code examples
perlpostgresqlplperl

can you use libraries in PL/Perl


I'm just curious if when writing PL/Perl functions if I can have a use My::Lib; statement, or enable pragma's and features (e.g. 'use strict; use feature 'switch';).


Solution

  • Not when using PL/Perl. It restricts the use of require and use, so you cannot import modules. However, you can install PL/Perlu (for unrestricted mode) which allows you to load modules.

    plperlu can be considered a security risk, however, as it also allows filesystem commands such as open.