[jifty-devel] Clickable object seems to act without authority

Jesse Vincent jesse at bestpractical.com
Mon Jun 4 08:31:54 EDT 2007


On Jun 3, 2007, at 12:21 AM, Andreas J. Koenig wrote:

> Today I wanted to study how certain things fit together and so I wrote
> in one of my mason fragments:
>
> % my $button = Jifty::Web::Form::Clickable->new( label => "BUTTON",  
> onclick => { args => { h_page => $last } } )->as_button;
> % warn "button[$button]";
>
> I expected that the code for the button would now appear on STDERR.
>
> But $button turned out to be empty and the button itself appeared in
> the page instead.
>
> Is this a bug or is this expected behaviour? And if so, how should I
> get the code snippet that is responsible for rendering the button?

"Historical accident" is closer to what's going on. In the early  
days, all of the web snippet generation was imperative. What needs to  
happen cleanup-wise is that Jifty::Web::Form::Field and friends need  
to be made context aware. When being rendered in a null context (! 
defined wantarray), they should have the old behaviour. Otherwise,  
they should be returning text.

The way we've coped for now is locally redefining Jifty::Web::out  
into an accumulator with an internal scalar that gets appended to and  
inspected.

-j



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070604/b473821f/PGP-0001.pgp


More information about the jifty-devel mailing list