Received: from thor.tht.net (thor.tht.net [209.47.145.4]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eB6C5xt10897 for ; Wed, 6 Dec 2000 07:05:59 -0500 (EST) (envelope-from bboett@erm1.u-strasbg.fr) Received: from erm1.u-strasbg.fr (qmailr@erm1.u-strasbg.fr [130.79.74.61]) by thor.tht.net (8.9.3/8.9.3) with SMTP id HAA71202 for ; Wed, 6 Dec 2000 07:42:35 GMT (envelope-from bboett@erm1.u-strasbg.fr) Received: (qmail 9936 invoked by uid 501); 6 Dec 2000 12:01:58 -0000 Date: Wed, 6 Dec 2000 13:01:58 +0100 From: Bruno Boettcher To: pgsql-sql@postgresql.org Subject: what's wrong with my plperl function? Message-ID: <20001206130158.A7713@erm1.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i X-Archive-Number: 200012/36 X-Sequence-Number: 367 Hello, i am still at the same stage.... thanks to Oliver Elphick the plperl module is working, as a stand alone per program the thing works (sole difference, i use $toparse = shift; instead of the $toparse = $_[0]; in the sql-function.... here's the thing: CREATE FUNCTION cleanFromSep(text,text) RETURNS int4 AS ' $toparse = $_[0]; $work = $_[0]; $format = $_[1]; print "first step $work\n"; $work =~s/\.//g; print "second step $work\n"; $work =~s/\,//g; print "final step $work\n"; $work *= 100 if($format =~/,\d{2}$/ && !($toparse=~/,\d{2}$/)); print "eventual mult step $work\n"; return $work; ' LANGUAGE 'plperl'; the perl script gives: ./test.pl 1.000.000 999.999.999,99 first step 1.000.000 second step 1000000 final step 1000000 eventual mult step 100000000 and the SQL function: select cleanFromSep('1.000.000','999.999.999,99'); cleanfromsep -------------- 0 (1 row) so what am i doing wrong? besides how can i output debug stuff from the perl script? print manifestingly doesn't work... -- ciao bboett ============================================================== bboett@earthling.net http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett =============================================================== the total amount of intelligence on earth is constant. human population is growing....