[jifty-devel] 'smart_tag_wrapper' to make creating smarter tags easier

Edmund von der Burg evdb at ecclestoad.co.uk
Fri Mar 16 05:26:47 EDT 2007


I've just committed code to Template::Declare that should make it
easier to create smarter wrappers in the templates - for example the
'form' wrapper. Please see the diff for the details.


Using this the 'form' sub in J::V::Declare::Helpers would become:

    no warnings qw/redefine/;
    sub form (&) {
        my $code = shift;

        smart_tag_wrapper {
          outs_raw( Jifty->web->form->start(@_) );
          outs_raw( Jifty->web->form->end );
          return '';

you could then call it like this (not tested properly):

my $action = ...setup_action..;
with( call => $next, name => "loginbox" ),
  form {
    render_action( $action, [qw(nick password remember)] );
    form_submit( label => 'Login', submit => $action );

and the form->start will get the call and next arguments.

I like it :)

If you think this is good then we can add it to the Jifty code. I've
held off as I don't want to break existing apps and also the version
of T::D would need bumping and the new version set in Makefile.PL

Have a good weekend.


In reality I'm evdb at ecclestoad.co.uk - http://ecclestoad.co.uk

More information about the jifty-devel mailing list