Hi,
While working to port some code to Embperl 2.0 I discovered some odd behavior with regards to subroutines and passing the $req object. I'm sure that I'm just doing it wrong, but code that worked in 1.3 will not work in 2.0. I didn't see any mention of changes in regards to how Embperl 2 handles subroutines and the $req object, but I could have missed it. Does anyone have any ideas?
base.html ---------- [- $req = shift; $req->{TEST} = "Hello World"; -] [- Execute ('*') -]
subs.epl ---------- [! $req = shift; !] [$ sub ccHelloWorld $] <p>Sub: [+ $req->{TEST} +]</p> [$ endsub $]
index.html ----------- [- $req = shift; $subs = Execute({object => 'subs.epl'}); $subs->ccHelloWorld; -] <p>Local: [+ $req->{TEST} +]</p>
Output in 1.3: --------------- Sub: Hello World
Local: Hello World
Output in 2.0b11: ----------------- Sub:
Local: Hello World
I've tried this a few different ways, including passing $req directly to the sub:
index.html ----------- $subs->ccHelloWorld($req);
subs.epl --------- [$ sub ccHelloWorld $] [- $req = shift -] ...
I've also tried the variations of Execute syntax isa=> and import=>1, but nothing seems to work. On the same topic, I've noticed that doing things like this in 1.3 was unreliable for me. Sometimes $req didn't get passed and pages would fail to work properly. This was rare, but happened enough that I stopped using the subs. I decided to try again in 2.0, but it's not working at all.
Cheers, John
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]