Embed run modes within a template
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.
Creates a new \*(C`CGI::Application::Plugin::AnyTemplate::ComponentHandler\*(C' object.
my $component_handler = CGI::Application::Plugin::AnyTemplate::ComponentHandler->new( webapp => $webapp, containing_template => $template, );
The \*(C`webapp\*(C' parameter should be a reference to a \*(C`CGI::Application\*(C' object. The \*(C`containing_template\*(C' parameter should be a reference to the template object in which this component is embedded.
Runs the specified \*(C`runmode\*(C' of the \*(C`webapp\*(C' 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.
Runs the specified \*(C`runmode\*(C' of the \*(C`webapp\*(C' 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 \s-1NOT\s0 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.
Michael Graham, \*(C`<[email protected]>\*(C'
Copyright 2005 Michael Graham, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.