Обсуждение: PLPERL

Поиск
Список
Период
Сортировка

PLPERL

От
"Szekely Zsolt-Csaba"
Дата:
Hi

I want to implement  a stored procedure written in plperl
which is able to evaluate expressions.
i would like to do something like :

...
 my ($a,$b,$c);
 $a=1;
 $b=2;

 eval ''$c=$a+$b;'';
 return $c;
...
Is it possible to do expression evaluation in plperl or other language?




Re: PLPERL

От
Alvaro Herrera
Дата:
On Wed, May 21, 2003 at 06:23:39PM +0300, Szekely Zsolt-Csaba wrote:

> I want to implement  a stored procedure written in plperl
> which is able to evaluate expressions.
> i would like to do something like :
>
> ...
>  my ($a,$b,$c);
>  $a=1;
>  $b=2;
>
>  eval ''$c=$a+$b;'';
>  return $c;
> ...
> Is it possible to do expression evaluation in plperl or other language?

Huh... why don't you try standard Perl expression evaluation?

... my ($a, $b);
    $a = 1;
    $b = 2;
    return $a + $b;
...

But maybe the answer is too simple, so this isn't really the question?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Postgres is bloatware by design: it was built to house
PhD theses." (Joey Hellerstein, SIGMOD annual conference 2002)