You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by benjamin-weiss <be...@us.army.mil> on 2000/05/03 06:28:09 UTC
Example on using [- Execute -] to recursively call sub?
Hi!
I've only been using EmbPerl for a few days, and I could really use some
help...
I'm using HTML-Embperl-1.3b3 with mod_perl and Apache. I'm trying to write
some recursive code, but am having problems with the paramater passing. If
I call the routine with:
[- recursive_print ($id) -]
I have no problem. But if I call it with:
[- Execute ('#recursive_print', $id) -]
or
[- Execute ({sub => '#recursive_print', param => $id }) -]
(and even more different types I've tried)
I keep getting:
HTML::Embprl::Req=SCALAR(0x84fc990)
or something similar.
Help! Desparately need to get this project done, and recursive code is
really the only way to do this.
Thanks!
Ben
----------------------------
BENJAMIN J. WEISS
2LT, SC, OKARNG
45th Infantry Brigade (SEP)
Signal Platoon Leader
RE: Example on using [- Execute -] to recursively call sub?
Posted by Gerald Richter <ri...@ecos.de>.
Hi!
>
> I've only been using EmbPerl for a few days, and I could really use some
> help...
>
> I'm using HTML-Embperl-1.3b3 with mod_perl and Apache. I'm
> trying to write
> some recursive code, but am having problems with the paramater
> passing. If
> I call the routine with:
>
> [- recursive_print ($id) -]
>
> I have no problem. But if I call it with:
>
> [- Execute ('#recursive_print', $id) -]
> or
> [- Execute ({sub => '#recursive_print', param => $id }) -]
>
If you give the param parameter you must pass an array ref, like:
[- Execute ({sub => '#recursive_print', param => [ $id ] }) -]
> (and even more different types I've tried)
>
> I keep getting:
>
> HTML::Embprl::Req=SCALAR(0x84fc990)
>
> or something similar.
>
> Help! Desparately need to get this project done, and recursive code is
> really the only way to do this.
>
If you call your sub via Execute, params are passed via the array @param. So
your $id is passed in $param[0].
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------