From: Bruno Boettcher <bboett@erm1.u-strasbg.fr>
To: pgsql-sql@postgresql.org
Subject: what's wrong with my plperl function?
Date: Wed, 6 Dec 2000 13:01:58 +0100
Message-ID: <20001206130158.A7713@erm1.u-strasbg.fr> (raw)
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/~bboetthttp://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: bboett@erm1.u-strasbg.fr
Subject: Re: what's wrong with my plperl function?
In-Reply-To: <20001206130158.A7713@erm1.u-strasbg.fr>
References: <20001206130158.A7713@erm1.u-strasbg.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox