> > 'cleanup' => -1
> >
> > which will disable cleanup at all, add $CLEANUP{'vars'} = 0 inside your
> > template, which should disable the cleanup only for that variable.
>
> That will work for this trivial example, but we have 107 templates on our
> site, each with 10 to 100 variables, and changing them all would be
> difficult, to say the least. Worse, if we missed one, we'd have those
> subtle bugs that are only occasionally apparent, but can cause real
> damage. Imagine if your credit card number was inadvertently passed to
> another customer in the template because we forgot to undef a variable?
>
> I think the right approach is to probably track down the cause of the
> variables not being undefined in the first place. I suppose I'll start
> hunting down the reason why this is occurring. Wish me luck. Any
> pointers as to where to focus are appreciated, of course. :)
>
If I had understand you right, the first call via execute to your template
works and the second not, right?
That's not a bug! Embperl cleans up all your global variables inside your
page after every request. $vars in your template is such a global variable,
so Embperl undef it and therfore the content gets lost and it won't work the
second time. That's excatly how Embperl works and how it is written in the
docs. So you can either disable the cleanup at all or for that variable, or
pass a copy to the variable:
# this will create an copy in an anonymous array (works only with array
refs)
${$compartment->varglob($_)} = [ @{$dataRef->{$_}} ] ;
Gerald