[Petal] petal:define question

Corey corey_s at qwest.net
Fri Jun 30 19:33:50 BST 2006


I'm totally stumped here, and can use some expert knowledge from
the list.


Simplified explanation/example:

I have a method called echo, looks like this:

sub echo {
   my $self  = shift;
   my $value = shift;

   return $value;
}

I stuff my object into $vcc, which gets passed to my 
template. Template looks like this:

<span petal:define="foobar string:GOOBER" />
<p petal:content="foobar" />
<p petal:content="vcc/echo foobar" />

<p>---</p>

<span petal:define="foobar string:BLAH" />
<p petal:content="foobar" />
<p petal:content="vcc/echo foobar" />


As I hope can be seen, I expect the following:

GOOBER
GOOBER
---
BLAH
BLAH


However... what I get is:

GOOBER
GOOBER
---
BLAH
GOOBER


What's going on here? 

It doesn't matter how I arrange things, the same behavior persists: where
a variable that's been reused ( even though it's been successfully redifined -
as can be seen ) and passed to a method or subroutine, the method in
question somehow gets stuffed with whatever the _initial_/_first_ definition
of the "petal:define'd" variable was...

Thanks for enlightening me!  Sorry if I missed something obvious
somewhere.


Cheers,

Corey


More information about the Petal mailing list