You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by nickyk <ni...@gmx.net> on 2000/07/13 11:12:55 UTC

HELP with Execute and params - it is very urgent

Hi folks

I nead to make some pages that pass data forth and back
Here is the source of it:

test.html:
-------------------------------------------------------------
<html>

[!
  sub getVals()
  {
    HTML::Embperl::Execute ({inputfile => './test1.html',output =>
\$restbl, req
    $escmode = 0;
  }

!]

[- getVals -]

<body>
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
[+ $restbl +]
</body>
</html>
---------------------------------------------------------------

test1.html:
---------------------------------------------------------------
[!

  sub getVals1()
  {
    my @p;
    HTML::Embperl::Execute({inputfile => 'test3.imp', param => \@p});
    &testParams();
  }

!]

[-
  #$p[0] = 20;
  getVals1();
-]

<table>
  <tr>
    <td>
      BBBBBBBBBBBBBBBBBB
    </td>
  </tr>
</table>
[+ $p[0] +]
-----------------------------------------------------------


test3.imp
----------------------------------------------------------
[$ sub testParams $]
[-
  $y = $param;
  $x = rand(100);
  $x ++;
  $y[0] = $x;
  #$param[0] = $x; <- generates error telling me that I try to modify
constant
-]
[$ endsub $]
-----------------------------------------------------------


I nead to get back the $x from test3.imp and to include in test1.html
but I do somthng wrong
Unfortunately I am out of time to continue testing and reading examples
so please if some body have experience with similar situation please to
tell me where exactly is the error
Actualy the situation is more complex and here is a simple test
situation - in my case I need to retun a hash value

Thanx in advance

Regards
Nickolay Kolev

--
======================================================
nickyk - a prime candidate for natural de-selection
http://www.nickyk.org                  icq# 1386837
======================================================




RE: HELP with Execute and params - it is very urgent

Posted by Gerald Richter <ri...@ecos.de>.
The param parameter of Execute is used when you call a whole file (not just
one sub in it). When calling a sub you can directly pass parameters:

call like:

    Execute({inputfile => 'test3.imp', import => 1});  # import the sub into
the current namespace (needed only once)
    testParams(\@p);

and sub looks like

[$ sub testParams $]
[-
my $p = shift ;

$x = rand(100);
$x ++;
$p -> [0] = $x;
-]
[$ endsub $]

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
-------------------------------------------------------------


> -----Original Message-----
> From: root@rt-h1.ecos.de [mailto:root@rt-h1.ecos.de]On Behalf Of nickyk
> Sent: Thursday, July 13, 2000 11:13 AM
> To: embperl@perl.apache.org
> Subject: HELP with Execute and params - it is very urgent
>
>
> Hi folks
>
> I nead to make some pages that pass data forth and back
> Here is the source of it:
>
> test.html:
> -------------------------------------------------------------
> <html>
>
> [!
>   sub getVals()
>   {
>     HTML::Embperl::Execute ({inputfile => './test1.html',output =>
> \$restbl, req
>     $escmode = 0;
>   }
>
> !]
>
> [- getVals -]
>
> <body>
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> [+ $restbl +]
> </body>
> </html>
> ---------------------------------------------------------------
>
> test1.html:
> ---------------------------------------------------------------
> [!
>
>   sub getVals1()
>   {
>     my @p;
>     HTML::Embperl::Execute({inputfile => 'test3.imp', param => \@p});
>     &testParams();
>   }
>
> !]
>
> [-
>   #$p[0] = 20;
>   getVals1();
> -]
>
> <table>
>   <tr>
>     <td>
>       BBBBBBBBBBBBBBBBBB
>     </td>
>   </tr>
> </table>
> [+ $p[0] +]
> -----------------------------------------------------------
>
>
> test3.imp
> ----------------------------------------------------------
> [$ sub testParams $]
> [-
>   $y = $param;
>   $x = rand(100);
>   $x ++;
>   $y[0] = $x;
>   #$param[0] = $x; <- generates error telling me that I try to modify
> constant
> -]
> [$ endsub $]
> -----------------------------------------------------------
>
>
> I nead to get back the $x from test3.imp and to include in test1.html
> but I do somthng wrong
> Unfortunately I am out of time to continue testing and reading examples
> so please if some body have experience with similar situation please to
> tell me where exactly is the error
> Actualy the situation is more complex and here is a simple test
> situation - in my case I need to retun a hash value
>
> Thanx in advance
>
> Regards
> Nickolay Kolev
>
> --
> ======================================================
> nickyk - a prime candidate for natural de-selection
> http://www.nickyk.org                  icq# 1386837
> ======================================================
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>