Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j9S0E-0006Mh-NY for pgsql-general@arkaria.postgresql.org; Wed, 04 Mar 2020 11:15:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j9S0C-0003ig-E2 for pgsql-general@arkaria.postgresql.org; Wed, 04 Mar 2020 11:15:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9S0C-0003gG-0I for pgsql-general@lists.postgresql.org; Wed, 04 Mar 2020 11:15:48 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9S09-0002AK-ST for pgsql-general@lists.postgresql.org; Wed, 04 Mar 2020 11:15:46 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 48XWX11Y58z1HS4 for ; Wed, 4 Mar 2020 06:15:45 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 48XWX06qs7zfYm; Wed, 4 Mar 2020 06:15:44 -0500 (EST) Date: Wed, 4 Mar 2020 06:15:44 -0500 From: stan To: pgsql-general@lists.postgresql.org Subject: Re: Use of perl modules in plperl ? Message-ID: <20200304111544.GA23072@panix.com> References: <20200304110322.GA4887@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304110322.GA4887@panix.com> X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Mar 04, 2020 at 06:03:22AM -0500, stan wrote: > 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. > Found plperlu in the docs. But some syntax help on referencing all the values returned by $_TD->{new} would be helpful. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin