The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CGI::Application::Plugin::View::HTML::Template - Automatically render HTML::Templates in CGI::Application

SYNOPSIS

  use base CGI::Application;
  use CGI::Application::Plugin::View::HTML::Template;
  use CGI::Application::Plugin::Stash; # Recommended
  
  sub setup {
    my $self = shift;
    $self->start_mode('mode1');
    $self->mode_param('rm');
    $self->run_modes(
            'mode1' => 'do_stuff',
             ...
    );
  }
  
  sub do_stuff {
  
    $self->stash->{foo} = 'bar';
  
    $self->stash->{template} = $self->load_tmpl('some.tmpl');
  
    return;
  
  }
 

DESCRIPTION

CGI::Application::Plugin::View adds Catalyst-like view processing to CGI::Application. This module automatically renders templates without setting template params or calling the template output method.

This module has no methods. Simply store your template and var(s) (CGI::Application::Plugin::Stash is recommended), and return from your runmode without returning template output. This module will automatically populate variables found in your template, and output it.

This module was inspired by Plugin::Stash. When I read the Catalyst::Manual::Tutorial two things seemed elegant to me: Stash and the way the template is processed automatically when the controller method is left. When I saw Plugin::Stash it caused me to remember the other thing I liked. So, I created this module. It doesn't do much. At a minimum it's a simple example of how to use CGI::Application's "add_callback" to postrun.

SEE ALSO

CGI::Application

HTML::Template

Catalyst

For additonal Catalyst-like functionality, see:

CGI::Application::Plugin::ActionDispatch

CGI::Application::Plugin::DebugScreen

CGI::Application::Plugin::Forward

CGI::Application::Plugin::Stash

AUTHOR

Mark Fuller, mfuller at c p a n /.\ o r g

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Mark Fuller

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.