[Petal] Re: petal:define question
Corey
corey_s at qwest.net
Fri Jun 30 19:57:17 BST 2006
Ok, well of course 20 minutes after sending out my question, I found the
answer to my own question. I need to 'fresh' it:
span petal:define="foobar string:GOOBER" />
<p petal:content="foobar" />
<p petal:content="fresh vcc/echo foobar" />
<p>---</p>
<span petal:define="foobar string:BLAH" />
<p petal:content="foobar" />
<p petal:content="fresh vcc/echo foobar" />
...works like charm.
I somehow missed that even after reading the Petal perldoc
many times. ugh.
Sorry for the noise.
Cheers,
Corey
On Friday 30 June 2006 11:33, Corey wrote:
>
> 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