Exec.pm


NAME

Exec - executor for compiled templates.


SYNOPSIS

 use Communiware::Exec;
 $e_sub = exec_func($template_id);
 $l_sub = lister_func($template_id);
 execute_template($ctx, $template_id);


DESCRIPTION

This module provides functions for working with compiled templates as well as running them.

exec_func

 $sub = Comuniware::Exec::exec_func($template_id);

Returns reference to exec function for given template. Dies unless such function exists.

lister_func

 $sub = lister_func($template_id);

Returns reference to lister function for given template or dies unless such function exists.

make_document

 $doc = make_document($ctx, $template)

Executes given template in given context, and returns document. Passed context should be already associated with appropriate empty document object.

If $template is string, template with this id is looked up in the database. If $template is code reference, it is considered ready to use template execution function.

clear_cache

        clear_cache()

Clears cache of compilied templates. This slows request processing down, but makes changes in the templates immediately visible.


INTERNAL FUNCTIONS

get_compiled_sub

 my $sub = get_compiled_sub($template_id, $idx);

Returns reference to stored in COMPILED_CODE functions for $template_id with index $idx. Function with 0-th index must exist. If index is greater than 0 and there are no such function for given $template_id then reference to an empty sub is returned.

show_profile

Prints profiling data.

16 октябрь 2007 13:44