NAME TemplateM - Templates processing module VERSION Version 2.01 23.10.2006 SYNOPSIS unshift(@INC,module_directory_absolute_path); require TemplateM; or: use lib module_directory_absolute_path; # if the module is installed in user's directory use TemplateM; Object $template creation as list: $template = new TemplateM(template_file,username,user_password, cache_files_absolute_path, timeout, http_header); or as implicit hash array (every key of hash array must be forestall the "-" sign): $template = new TemplateM(-file=>'template_file',-user=>'username',-password=>'user_pass word', -cache=>'cache_files_absolute_path', -timeout=>'timeout', -header=>'HTTP_header'); or as reference to hash array or as hash array: $template = new TemplateM({file=>'template_file',user=>'username',password=>'user_passwo rd', cache=>'cache_files_absolute_path', timeout=>'timeout', header=>'HTTP_header'}); Update object $template $template->update(template_file, username, user_password, cache_files_absolute_path, timeout, http_header); Method "update" is used like "new" method, but "new" method is more prefer template_file template filename. The template file have to be located in CGI-script directory or one level up directory. If the module can't able to obtain access to the file, the error message will be evoked. username username of virtual client. The username have to be present in .htaccess file (or in other Apache's configuration file like .htaccess). Set username blank then you don't use HTTP-authorization via Apache. user_password User password of virtual client. See username cache_files_absolute_path Absolute path to the cache directory. Cache will not be used when this parameter is not presented. timeout Timeout is the period (in seconds) of template's updating delay. Default value is 1200 seconds. if updating delay parameter is "-1" the updating delay will be perpetual HTTP_header HTTP_header is used to send a raw HTTP header before template processing by html method Modification of labels (cgi labels) $template->cast({label=>value, label=>value, ...=>...}); or $template->cast(label=>value, label=>value, ...=>...); label Label - name will be replaced with appropriate value in tag value Value - Value, which CGI-script sets. Member of label Block labels modification (val labels) $template->cast_loop ("block_name", [{label=>value, label=>value, ...=>...}]); or $template->cast_loop ("block_name", {label=>value, label=>value, ...=>...}); or $template->cast_loop ("block_name", %hash); block_name Block_name - Block identification name. The name will be inserted in tags and - all content between this tags processes like labels, but the tag will be formed as CAST_IF method $template->cast_if('block_name', 'condition'); method prints blocks according to the condition. if condition is true the if-block will be printed: block content if and else-block not will be printed. If the condition is false, vice versa, else-block will be printed and if-block will be passed In all of cases names of this blocks must bethe same! Block finalizing $template->finalize(block_name); Block finalizing uses for not-processed blocks deleting. You need use finalizing every time you use blockes. Template finalizing print $template->html(-header=>'HTTP_header') || 'Inner error!'; or print $template->html({header=>'HTTP_header'}) || 'Inner error!'; or print $template->html('HTTP_header') || 'Inner error!'; The procedure will return formed document after template processing. if header is present as argument it will be added at the beginning of template's return. DESCRIPTION The module can be used with SSI directives together, like in this shtml-sample:

ENVIRONMENT No environment variables are used. SEE ALSO perl DIAGNOSTICS The usual warnings if it cannot read or write the files involved. HISTORY 1.00 Initial release 1.10 Working with cache ability is added 1.11 Inner method's interface had structured 1.21 New time managment for templates caching. You can set how long template file will be cached before renew. 2.00 - Simultaneous templates using errors is eliminated. - Alternate interface of using methods is added. - Method of conditional representation of template CAST_IF is added. 2.01 Cache-file access errors corrected THANKS Thanks to Andrew Syrba for useful and valuable information. Thanks to Dmitry Klimov for technical translating. AUTHOR Lepenkov Sergey (Serz Minus), "" COPYRIGHTS Copyright (C) 1998-2006 D&D Corporation. All Rights Reserved