RE: How Embperl sub routine retun value?

1999-12-16 Thread Albert Liu


Read about how Perl passes parameters :-)

You shift the value of your parameter into $bb, now you modifiy $bb, but $bb
is a variable of it's own, it has nothing to do with the parameter you pass.
Reread my example and write your sub like this:

[$ sub TTEST $]
[- $aa = 3;  -]
p$aa is [+$aa+]
[- $_[0] = $aa; -]
[$ endsub $]



Gerald


It works, but I never thought i can use this way to pass parameter. Indeed
i never read this in "Programming Perl" book. Perhaps it is at some where
it the book

Anyway, thank you.
Albert



RE: How Embperl sub routine retun value?

1999-12-11 Thread Albert Liu

Hi Gerald,

Thanks, it works, but the sub routine has to be in same files. How about
the sub routine is "Execute" from external lib file? I test it, it doesn't
work, do you know how to pass value between sub routines they are not  in
same file?

Regards,
Albert

At 08:47 AM 12/10/99 +0100, Gerald Richter wrote:
Hi,

 Does anyone know how to return or pass a value inside Embperl sub routine?

You can pass argument like to any other perl subroutine. Unfortunately
return doesn't work right now, but you can return a value by assigning it to
one of the arguments.

Like

 [$ sub TTEST $]
[- $aa = 2; -]
p$aa is [+$aa+]
[- $_[0] = $aa; -]
 [$ endsub $]

 [- TTEST($bb); -]
p$bb is [+$bb+]

Gerald


-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-





How Embperl sub routine retun value?

1999-12-09 Thread Albert Liu

Hi,

Does anyone know how to return or pass a value inside Embperl sub routine?

Like 
[$ sub TTEST $]
   [- $aa = 2;
   p$aa is [+$aa+]
   [- return $aa; -]
[$ endsub $]

[- $bb = TTEST(); -]
   p$bb is [+$bb+]

The result is 

$aa is 2
$bb is 0

What is wrong?

Thanks
Albert