CGI::Application::Plugin::AnyTemplate::ComponentHandler(3pm)

CGI::Application::Plugin::AnyTemplate::ComponentHandler3pm

Embed run modes within a template

Overview

This is a little helper module used by CGI::Application::Plugin::AnyTemplate to handle finding and running the run modes for embedded components, and returning their content.

You shouldn't need to use this module directly unless you are adding support for a new template system.

For information on embedded components see the docs of CGI::Application::Plugin::AnyTemplate.

Methods

new

Creates a new "CGI::Application::Plugin::AnyTemplate::ComponentHandler" object.

    my $component_handler = CGI::Application::Plugin::AnyTemplate::ComponentHandler->new(
        webapp              => $webapp,
        containing_template => $template,
    );

The "webapp" parameter should be a reference to a "CGI::Application" object.

The "containing_template" parameter should be a reference to the template object in which this component is embedded.

embed

Runs the specified "runmode" of the "webapp" object. Returns the results of this call.

Parameters passed to embed should be passed on to the run mode.

If the results are a scalar reference, then the return value is dereferenced before returning. This is the safest way of calling a run mode since you'll get the output as a string and return it as a string, but it involves returning potentially very large strings from subroutines.

embed_direct

Runs the specified "runmode" of the "webapp" object. Returns the results of this call.

Parameters passed to embed_direct should be passed on to the run mode.

Even if the result of this call is a scalar reference, the result is NOT dereferenced before returning it.

If you call this method instead of embed, you should be careful to deal with the possibility that your results are a reference to a string and not the string itself.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 5 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9–10
  6. 11–13

Author

Michael Graham, "<[email protected]>"

From libcgi-application-plugin-anytemplate-perl 0.18-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.