You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jonny Cavell <jc...@iii.co.uk> on 2000/10/03 15:57:58 UTC

general (but important!) problems using Embperl

Hi,

Can anybody help with these exciting problems:

1) When using [$ var $x $y $], these global variables are not visable to any
Embperl files called via Execute (although %fdat,  %udat etc. are).
Moreover, these Executed files can have non pre-declared global variables
(i.e. be un-strict), and Embperl does not complain:

parent.epl
--------------
[$ var $one $]
[- $one = 1; Execute 'ex.epl' -]

ex.epl
--------
one: [+ $one +], two: [+ $two +]

Output is one: , two:


2) More worrying is that if you Execute an embperl file which has [$ var
$test $] in it, the value of $test persists if the same file is Executed
again, from the same parent file. In other words, $test is not getting
initialised each time the component is Executed:

test.epl
----------
[$ var $test $]
[- $test = $param[0] if $param[0]; -]
[+ $test +]

Then I Execute this twice from a parent Embperl file, but with different
parameters:

parent.epl
--------------
Execute 'test.epl', 'this is a test';
Execute 'test.epl';

Both Executes output 'This is a test'.

3) Finally, if I have a function, verify:

sub verify{
	print shift;
}

And I call it 2ways:

&verify()
correctly prints nothing

&verify
incorrectly prints 'HTML::Embperl::Req=SCALAR(0xc99b14)'

Cheers,

Jonny


Re: general (but important!) problems using Embperl

Posted by ___cliff rayman___ <cl...@genwax.com>.
Jonny Cavell wrote:

> Hi,
>
> Can anybody help with these exciting problems:
>
> 1) When using [$ var $x $y $], these global variables are not visable to any
> Embperl files called via Execute (although %fdat,  %udat etc. are).
> Moreover, these Executed files can have non pre-declared global variables
> (i.e. be un-strict), and Embperl does not complain:

define and use fully qualified package variables
[$ var $global::one $]

one: [+ $global::one +], two: [+ $two +]

>
> 2) More worrying is that if you Execute an embperl file which has [$ var
> $test $] in it, the value of $test persists if the same file is Executed
> again, from the same parent file. In other words, $test is not getting
> initialised each time the component is Executed:
>

set the cleanup parameter to 1 to cleanup globals immediately.  otherwise they get cleared
after we are done with the client.

Execute ({inputfile=> 'test.epl', cleanup => 1});
Execute ({inputfile=> 'test.epl', cleanup => 1});

hth,
--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/