what's wrong with my plperl function?

Поиск
Список
Период
Сортировка
От Bruno Boettcher
Тема what's wrong with my plperl function?
Дата
Msg-id 20001206130158.A7713@erm1.u-strasbg.fr
обсуждение исходный текст
Ответы Re: what's wrong with my plperl function?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@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....


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

Предыдущее
От: Michael Ansley
Дата:
Сообщение: RE: Using SELECT as DDL/DML statement is wrong (was RE: rei nitialize a sequence?)
Следующее
От: "Edmar Wiggers"
Дата:
Сообщение: RE: Using SELECT as DDL/DML statement is wrong (was RE: reinitialize a sequence?)