The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Changes for version 0.11

  • fixed a bug fill/process when called with a single non-hashref argument. The following used to be broken; now they DWIM:
    • $self->template->fill('filename'); $self->template->fill(\$template);
  • fixed a bug in template_post_process that has been there since the beginning. The callback was being called as:
    • template_post_process($self, \$output) # wrong!
    • But it was documented as:
      • template_post_process($self, $template, \$output) # right!
    • It's been fixed to match the documentation.

Changes for version 0.10_06

  • added an explit test to see if HTML::Template::Plugin::Dot works

Changes for version 0.10_05

  • fixed a bug in the tests for testing module prerequisites
  • it is now possible to run the test suite while simulating the absense of specific templating modules. To run the test suite multiple times (each with a different selection of absent modules), run:
    • $ perl misc/prove_without_modules.pl t/*.t
    • To customize this process, see the instructions at the top of misc/prove_without_modules.pl

Changes for version 0.10_04

  • new driver HTMLTemplatePluggable has support for HTML::Template::Pluggable and HTML::Template::Plugin::Dot (thanks to Mark Stosberg for starting the driver)

Changes for version 0.10_03

  • moved 'forward' to its own module: CGI::Application::Plugin::Forward
  • changed instances of 'use base' to use... and @ISA to be kinder to old Perls
  • made hook-based tests skip if installed CGI::Application doesn't support hooks

Changes for version 0.10_02

  • wrapped usage of CGI::Application's callback system in
    • if ($webapp->can('call_hook')) { ... }
    • ...or equivalent, so CGI::Application 4.x is not required.

Changes for version 0.10_01

  • this version has several API changes that are not backwards compatible:
    • template names used to be automatically determined from the name of the calling subroutine:
      • sub my_runmode { my $self = shift; $self->other_method; } sub other_method { my $self = shift; $self->template->fill; # loads 'other_method.html' }
      • There were two problems with this method: 1. Not every subroutine or method is a run mode 2. Under debuggers, the name of the calling subroutine is often not available, so code that uses automatic template names can't be run under a debugger.
      • So now AnyTemplate has been changed to get the template name from $self->get_current_runmode:
        • sub my_runmode { my $self = shift; $self->other_method; } sub other_method { my $self = shift; $self->template->fill; # loads 'my_runmode.html' }
      • If you want to pass control to another runmode and you want $self->get_current_runmode to be updated, then you use the new 'forward' method:
        • sub my_runmode { my $self = shift; return $self->forward('other_runmode'); } sub other_runmode { my $self = shift; $self->template->fill; # loads 'other_runmode.html' }
    • template_pre_process and template_post_process are no longer called automatically. Instead you must register them as hooks.
      • $self->add_callback('template_pre_process', \&template_pre_process); $self->add_callback('template_post_process', \&template_post_process);
    • associate_query and emulate_associate_query have now been disabled by default. Having this feature enabled by default was a potential XSS (Cross Site Scripting) security risk. The use of this feature is now deprecated. The feature will be removed in the future
  • other changes:
    • added option to override load_tmpl. It is enabled by:
      • use CGI::Application::Plugin::AnyTemplate qw(load_tmpl);
      • When this feature is enabled, you can do the following:
        • $self->load_tmpl('somefile.txt', path => '/path/to/templates', %other_options );
      • And this is translated into:
        • $self->template->load('somefile.txt', add_include_path => '/path/to/templates', HTMLTemplate => \%other_options, auto_add_template_extension => 0, );
    • added support for the load_tmpl hook, compatible with the one built into CGI::Application
    • $self->tmpl_path is now merged into 'include_path'
    • documentation for authors of plugins and re-usable applications
    • documentation for why the automatic extension mechanism is there
    • re-numbered some test scripts

Modules

Use any templating system from within CGI::Application using a unified interface
HTML::Template::Expr driver to AnyTemplate
HTML::Template::Pluggable driver to AnyTemplate
Template::Toolkit plugin to AnyTemplate