Use of perl modules in plperl ?

Поиск
Список
Период
Сортировка
От stan
Тема Use of perl modules in plperl ?
Дата
Msg-id 20200304110322.GA4887@panix.com
обсуждение исходный текст
Ответы Re: Use of perl modules in plperl ?  (stan <stanb@panix.com>)
Re: Use of perl modules in plperl ?  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-general
I am trying to examine the values of $_TD->{new}. I thought the easiest way
to see what this structure looked like was to use the Dumper functionality.
To do so I need to include the appropriate Perl module, which I would think
would be done like this:

use Data::Dumper qw(Dumper);

But inserting that into the script to create the function, like this:

CREATE OR REPLACE FUNCTION valid_id() RETURNS trigger AS $$
use Data::Dumper qw(Dumper);
    if (($_TD->{new}{i} >= 100) || ($_TD->{new}{i} <= 0)) {
    ......

Returned this error message:

ERROR:  Unable to load Data/Dumper.pm into plperl at line 2.
BEGIN failed--compilation aborted at line 2.
CONTEXT:  compilation of PL/Perl function "valid_id"

What do I have to do to use Perl modules in plperl function/

BTW this works outside plperl

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper qw(Dumper);

..................

Thanks for the help.

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
                        -- Benjamin Franklin



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Poor plan choice with partial unique indexes on jsonb column and simple RLS policy (with test script)
Следующее
От: stan
Дата:
Сообщение: Re: Use of perl modules in plperl ?