From: | Bruno Boettcher <bboett(at)erm1(dot)u-strasbg(dot)fr> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | what's wrong with my plperl function? |
Date: | 2000-12-06 12:01:58 |
Message-ID: | 20001206130158.A7713@erm1.u-strasbg.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)earthling(dot)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....
From | Date | Subject | |
---|---|---|---|
Next Message | Edmar Wiggers | 2000-12-06 12:43:59 | RE: Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?) |
Previous Message | Michael Ansley | 2000-12-06 10:19:45 | RE: Using SELECT as DDL/DML statement is wrong (was RE: rei nitialize a sequence?) |