On Wed, Dec 19, 2001 at 08:44:21PM +0200, Jaak wrote:
> When I use 
> [- require "test.pl"; -]
> 
> test.pl => 
> $lang{'test'} = "testing..."; 1;
> 
> appeares only once when using [+ $lang{'test'} +]
> When realoading page $lang{'test'} seems to be empty.
> 
> What am I doing wrong?

1. using require (like that) will load %lang into the current namespace.

2. embperl nukes all variables it finds in the namespace after each Execute.

3. require won't reload a file it thinks has already been loaded.

so, either:

1. load %lang into a different namespace, so embperl won't find it:
  test.pl =>  '$mypkg::lang{test} = "testing..."; 1;'
  [+ $mypkg::lang{test} +]
 This will also mean you only have to try loading test.pl once
 (ie: [! use 'test.pl' !] rather than [- require 'test.pl' -]).

2. make embperl not nuke %lang:
  [- $CLEANUP{%lang} = 0 -]

3. always reload test.pl:
  [- do 'test.pl' -]


the "correct" method is probably (1), but using the "package" keyword,
rather than fully qualifying all the symbols. voila, you've just written
a perl module.

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to