[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    RE: Embperl: my-variables in [$sub ...$][$endsub$] blocks?
From:       "Gerald Richter" <richter () ecos ! de>
Date:       2000-01-31 14:51:23
[Download RAW message or body]

Hi,
>
> I'd like to use subroutines within my Embperl documents which
> use parameters. The usage proposed in the manual
>
>   [$ sub foo $]
>     [- $p = shift -]
>     <p> parameter: [+ $p +]</p>
>   [$ endsub $]
>
> works but defines $p globally, which is quite inconvenient.
>
> However, adding "my" to get
> [- my $p = shift -]
> does not work because this way $p is only
> visible within this assignment.
>
> Is it possible to get local parameters here (without
> accessing $_[0] etc. directly, of course)? Should I use
> [* *] instead?
>
Currently it isn't possible, but because every page is running in it's own
namespace and Embperl cleans up all your variables after the request, it
isn't such a problem. It's more a problem of programming style. Anyway the
next release of Embperl (not the next beta, but one of the nexts), will
solve this problem.

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic