.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::Template::Compiled 3pm" .TH HTML::Template::Compiled 3pm "2022-11-19" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::Template::Compiled \- Template System Compiles HTML::Template files to Perl code .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 6 \& use HTML::Template::Compiled; \& # recommended options: \& # case_sensitive => 1 \& # search_path_on_include => 1 \& # use_query => 0 \& # default_escape => \*(AqHTML\*(Aq # <\-\- HIGHLY RECOMMENDED \& \& # note that the following \& # use HTML::Template::Compiled speed => 1 \& # is deprecated (can be problematic under persistent environments) \& \& # or for the biggest compatibility with HTML::Template \& # case_sensitive => 0 \& # search_path_on_include => 0 \& # use_query => 1 \& # note that the following \& # use HTML::Template::Compiled compatible => 1; \& # is deprecated (can be problematic under persistent environments) \& \& # or use HTML::Template::Compiled::Classic \& \& my $htc = HTML::Template::Compiled\->new( \& filename => \*(Aqtest.tmpl\*(Aq, \& case_sensitive => 1, \& default_escape => \*(AqHTML\*(Aq, \& ); \& $htc\->param( \& BAND => $name, \& ALBUMS => [ \& { TITLE => $t1, YEAR => $y1 }, \& { TITLE => $t2, YEAR => $y2 }, \& ], \& ); \& print $htc\->output; \& \& test.tmpl: \& Band: \& \& Title: () \& \& \& Or use different tag styles: \& Band: <%= BAND %> \& <%loop ALBUMS %> \& Title: <%= TITLE %> (<%= YEAR %>) \& <%/loop %> \& Band: [%= BAND %] \& [%loop ALBUMS %] \& Title: [%= TITLE %] ([%= YEAR %]) \& [%/loop %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" HTML::Template::Compiled is a template system which can be used for HTML::Template templates with almost the same \s-1API.\s0 It offers more flexible template delimiters, additional tags and features, and by compiling the template into perl code it can run significantly faster in persistent environments such as FastCGI or mod_perl. .PP The goal is to offer more features for flexibility but keep the basic syntax as easy as it is. .PP Features at a glance: .IP "Dot notation for objects, hashes and arrays" 4 .IX Item "Dot notation for objects, hashes and arrays" .PD 0 .IP "Use expressions without any disadvantages like those in HTML::Template::Expr" 4 .IX Item "Use expressions without any disadvantages like those in HTML::Template::Expr" .IP "Write escaping plugins and plugins for new tags" 4 .IX Item "Write escaping plugins and plugins for new tags" .ie n .IP "Alternate delimiters, e.g. ""[%if %]"" and ""<%if %>""" 4 .el .IP "Alternate delimiters, e.g. \f(CW[%if %]\fR and \f(CW<%if %>\fR" 4 .IX Item "Alternate delimiters, e.g. [%if %] and <%if %>" .ie n .IP "Avoid ""global_vars"" option by using the ""SET_VAR"" tag to create aliases." 4 .el .IP "Avoid \f(CWglobal_vars\fR option by using the \f(CWSET_VAR\fR tag to create aliases." 4 .IX Item "Avoid global_vars option by using the SET_VAR tag to create aliases." .IP "Tags \s-1ELSIF, EACH, WHILE, COMMENT, WRAPPER, SWITCH/CASE, INCLUDE_VAR\s0" 4 .IX Item "Tags ELSIF, EACH, WHILE, COMMENT, WRAPPER, SWITCH/CASE, INCLUDE_VAR" .IP "Chomp newlines/whitespace" 4 .IX Item "Chomp newlines/whitespace" .PD .PP For a quick reference, see HTML::Template::Compiled::Reference. .PP As the basic features work like in HTML::Template, please get familiar with its documentation before. .PP HTML::Template::Compiled (\s-1HTC\s0) does not implement all features of HTML::Template (see \*(L"\s-1COMPATIBILITY\*(R"\s0), and it has got some additional features which are explained below: \&\*(L"\s-1ADDITIONAL FEATURES\*(R"\s0 .PP See \*(L"\s-1BENCHMARKS\*(R"\s0 for some examples on the performance. Since it depends highly on the options used and on the template size there can be no general statement on its performance. .PP You might want to use HTML::Template::Compiled::Lazy for \s-1CGI\s0 environments as it doesn't parse the template before calling output. But note that HTC::Lazy isn't much tested, and I don't use it myself, so there's a lack of experience. If you use it and have problems, please report. .PP \&\s-1HTC\s0 will use a lot of memory because it keeps all template objects in memory. If you are on mod_perl, and have a lot of templates, you should preload them at server startup to be sure that it is in shared memory. At the moment \s-1HTC\s0 is not fully tested for keeping all data in shared memory (e.g. when a copy-on-write occurs), but it seems like it's behaving well. For preloading you can use HTML::Template::Compiled\->preload($cache_dir). .PP Generating code, writing it on disk and later \fBeval()\fR it can open security holes, for example if you have more users on the same machine that can access the same files (usually an http server running as 'www' or 'nobody'). See \*(L"\s-1SECURITY\*(R"\s0 for details what you can do to safe yourself. .PP \&\s-1NOTE:\s0 If you don't need any of the additional features listed below and if you don't need the speed (in many cases it's probably not worth trading speed for memory), then you might be better off with just using HTML::Template. .PP \&\s-1NOTE2:\s0 If you have any questions, bug reports, send them to me and not to Sam Tregar. This module is developed by me at the moment, independently from HTML::Template, although I try to get most of the tests from it passing for \s-1HTC.\s0 See \*(L"\s-1RESOURCES\*(R"\s0 for current information. .SS "\s-1FEATURES FROM HTML::TEMPLATE\s0" .IX Subsection "FEATURES FROM HTML::TEMPLATE" .IP "\s-1TMPL_VAR\s0" 4 .IX Item "TMPL_VAR" .PD 0 .IP "\s-1TMPL_LOOP\s0" 4 .IX Item "TMPL_LOOP" .IP "\s-1TMPL_\s0(IF|UNLESS|ELSE)" 4 .IX Item "TMPL_(IF|UNLESS|ELSE)" .IP "\s-1TMPL_INCLUDE\s0" 4 .IX Item "TMPL_INCLUDE" .IP "\s-1HTML_TEMPLATE_ROOT\s0" 4 .IX Item "HTML_TEMPLATE_ROOT" .IP "ESCAPE=(HTML|URL|JS|0)" 4 .IX Item "ESCAPE=(HTML|URL|JS|0)" .IP "DEFAULT=..." 4 .IX Item "DEFAULT=..." .ie n .IP """_\|_first_\|_"", ""_\|_last_\|_"", ""_\|_inner_\|_"", ""_\|_outer_\|_"", ""_\|_odd_\|_"", ""_\|_counter_\|_"", ""_\|_even_\|_""" 4 .el .IP "\f(CW_\|_first_\|_\fR, \f(CW_\|_last_\|_\fR, \f(CW_\|_inner_\|_\fR, \f(CW_\|_outer_\|_\fR, \f(CW_\|_odd_\|_\fR, \f(CW_\|_counter_\|_\fR, \f(CW_\|_even_\|_\fR" 4 .IX Item "__first__, __last__, __inner__, __outer__, __odd__, __counter__, __even__" .IP "" 4 .IX Item "" .IP "case insensitive var names" 4 .IX Item "case insensitive var names" .PD use option case_sensitive => 0 to use this feature (slow down) .IP "filters" 4 .IX Item "filters" .PD 0 .IP "vars that are subrefs \- not implemented, only in HTML::Template::Compiled::Classic" 4 .IX Item "vars that are subrefs - not implemented, only in HTML::Template::Compiled::Classic" .IP "scalarref, arrayref, filehandle" 4 .IX Item "scalarref, arrayref, filehandle" .ie n .IP """global_vars""" 4 .el .IP "\f(CWglobal_vars\fR" 4 .IX Item "global_vars" .ie n .IP """query""" 4 .el .IP "\f(CWquery\fR" 4 .IX Item "query" .PD Has a bug (doesn't return parameters in included files of included files). I'm working on that. .SS "\s-1ADDITIONAL FEATURES\s0" .IX Subsection "ADDITIONAL FEATURES" What can \s-1HTC\s0 do for you additionally to HTML::Template? .IP "tag \s-1TMPL_ELSIF\s0" 4 .IX Item "tag TMPL_ELSIF" No need to have cascading \*(L"if\-else\-if\-else\*(R"s .IP "tag \s-1TMPL_EACH\s0" 4 .IX Item "tag TMPL_EACH" Iterate over a hash. See \*(L"\s-1TMPL_EACH\*(R"\s0 .IP "tag \s-1TMPL_WITH\s0" 4 .IX Item "tag TMPL_WITH" see \*(L"\s-1TMPL_WITH\*(R"\s0 .IP "tag \s-1TMPL_WHILE\s0" 4 .IX Item "tag TMPL_WHILE" see \*(L"\s-1TMPL_WHILE\*(R"\s0 .IP "tag \s-1TMPL_SET_VAR\s0" 4 .IX Item "tag TMPL_SET_VAR" see \*(L"\s-1SET_VAR\*(R"\s0 .IP "tag \s-1TMPL_USE_VARS\s0" 4 .IX Item "tag TMPL_USE_VARS" see \*(L"\s-1USE_VARS\*(R"\s0 .IP "tags \s-1TMPL_COMMENT, TMPL_NOPARSE, TMPL_VERBATIM\s0" 4 .IX Item "tags TMPL_COMMENT, TMPL_NOPARSE, TMPL_VERBATIM" see \*(L"\s-1TMPL_COMMENT\*(R"\s0, \*(L"\s-1TMPL_NOPARSE\*(R"\s0, \*(L"\s-1TMPL_VERBATIM\*(R"\s0 .IP "tag \s-1TMPL_WRAPPER\s0" 4 .IX Item "tag TMPL_WRAPPER" see \*(L"\s-1WRAPPER\*(R"\s0 .ie n .IP """_\|_index_\|_""" 4 .el .IP "\f(CW_\|_index_\|_\fR" 4 .IX Item "__index__" Additional loop variable (\f(CW\*(C`_\|_counter_\|_ \-1\*(C'\fR) .ie n .IP """_\|_break_\|_""" 4 .el .IP "\f(CW_\|_break_\|_\fR" 4 .IX Item "__break__" Additional loop variable (see \*(L"\s-1TMPL_LOOP\*(R"\s0) .ie n .IP """_\|_filename_\|_"", ""_\|_filenameshort_\|_"" (since 0.91_001)" 4 .el .IP "\f(CW_\|_filename_\|_\fR, \f(CW_\|_filenameshort_\|_\fR (since 0.91_001)" 4 .IX Item "__filename__, __filenameshort__ (since 0.91_001)" Insert the template filename for debugging: .Sp .Vb 2 \& <%= _\|_filename_\|_ %> \& <%= _\|_filenameshort_\|_ %> .Ve .Sp will turn out as: templates/path/file.html path/file.html .Sp See also option debug_file in \*(L"\s-1OPTIONS\*(R"\s0 for adding the filename globally. .IP "tags \s-1TMPL_SWITCH, TMPL_CASE\s0" 4 .IX Item "tags TMPL_SWITCH, TMPL_CASE" see \*(L"\s-1TMPL_SWITCH\*(R"\s0 .ie n .IP """TMPL_PERL""" 4 .el .IP "\f(CWTMPL_PERL\fR" 4 .IX Item "TMPL_PERL" Include perl code in your template. See \*(L"\s-1RUNNING PERL WITH TMPL_PERL\*(R"\s0 .IP "\s-1CHOMP\s0" 4 .IX Item "CHOMP" New in version 0.96_001, please report any bugs and send me suggestions. .Sp You can set global chomp options in the constructor. These work like in Template-Toolkit: .Sp .Vb 4 \& my $htc = HTML::Template::Compiled\->new( \& pre_chomp => 0, # 0, 1, 2, 3, default 0 \& post_chomp => 1, # 0, 1, 2, 3, default 0 \& ); .Ve .Sp Meaning of the values: 0: Don't chomp 1: remove only spaces in the line before or after the tag 2: remove all whitespaces before or after the tag, and replace with one space 3: remove all whitespaces before or after the tag .Sp In the template you can change that feature by using \s-1PRE_CHOMP\s0 and \s-1POST_CHOMP\s0 attributes: .Sp .Vb 1 \& <%= foo PRE_CHOMP=3 POST_CHOMP=1 %> .Ve .Sp The experimental tags +..._chomp have been removed. .IP "Generating perl code" 4 .IX Item "Generating perl code" See \*(L"\s-1IMPLEMENTATION\*(R"\s0 .IP "better variable access" 4 .IX Item "better variable access" dot-notation for accessing hash values. See \*(L"\s-1EXTENDED VARIABLE ACCESS\*(R"\s0 .IP "rendering objects" 4 .IX Item "rendering objects" dot-notation for accessing object methods. See \*(L"\s-1RENDERING OBJECTS\*(R"\s0 .IP "output to filehandle" 4 .IX Item "output to filehandle" See \*(L"\s-1OPTIONS\*(R"\s0 .IP "Dynamic includes" 4 .IX Item "Dynamic includes" \&\f(CW\*(C`INCLUDE_VAR\*(C'\fR, \f(CW\*(C`INCLUDE_STRING\*(C'\fR. See \*(L"\s-1INCLUDE\*(R"\s0 .IP "tag \s-1TMPL_IF_DEFINED\s0" 4 .IX Item "tag TMPL_IF_DEFINED" Check for definedness instead of truth: <\s-1TMPL_IF_DEFINED\s0 NAME=\*(L"var\*(R"> .IP "\s-1ALIAS\s0" 4 .IX Item "ALIAS" Set an alias for a loop variable. You can use the alias then with \f(CW$alias\fR. The syntax without the \f(CW\*(C`$\*(C'\fR is also possible but not recommended any more. .Sp For example, these two loops are functionally equivalent: .Sp .Vb 6 \& \& \& \& \& \& .Ve .Sp This works with \f(CW\*(C`TMPL_LOOP\*(C'\fR and \f(CW\*(C`TMPL_WHILE\*(C'\fR at the moment. .Sp You can also set aliases with the \f(CW\*(C`SET_VAR\*(C'\fR tag. See \*(L"\s-1SET_VAR\*(R"\s0 .Sp To use template parameters with a \f(CW\*(C`$\*(C'\fR at the beginning (which is not officially supported, but some are obviously using it), you can set: .Sp .Vb 1 \& local $HTML::Template::Compiled::Compiler::DISABLE_NEW_ALIAS = 1; .Ve .Sp This is only a temporary workaround and will be removed some day! .Sp Note that you are also able to access variables with dollar signs like this: .Sp .Vb 1 \& .Ve .Sp since underscore means current position in the parameter stash, and aliases are only recognized at the beginning of a template var. But note that dollar signs are still not officially supported. .IP "Chained escaping" 4 .IX Item "Chained escaping" See \*(L"\s-1ESCAPING\*(R"\s0 .IP "tagstyles" 4 .IX Item "tagstyles" For those who like it (i like it because it is shorter than \s-1TMPL_\s0), you can use <% %> tags and the <%= tag instead of <%VAR (which will work, too): .Sp .Vb 1 \& <%IF blah%> <%= VARIABLE%> <%/IF%> .Ve .Sp Define your own tagstyles and/or deactivate predefined ones. See \*(L"\s-1OPTIONS\*(R"\s0 tagstyle. .IP "pre_chomp, post_chomp" 4 .IX Item "pre_chomp, post_chomp" See \*(L"\s-1CHOMP\*(R"\s0 .SS "\s-1MISSING AND DIFFERENT FEATURES\s0" .IX Subsection "MISSING AND DIFFERENT FEATURES" There are some features of H::T that are missing or behaving different. I'll try to list them here. .PP \fI\s-1MISSING FEATURES\s0\fR .IX Subsection "MISSING FEATURES" .IP "die_on_bad_params" 4 .IX Item "die_on_bad_params" I don't think I'll implement that. .IP "force_untaint" 4 .IX Item "force_untaint" Not planned at the moment .IP "vanguard_compatibility_mode" 4 .IX Item "vanguard_compatibility_mode" Not planned. .IP "shared_cache, double_cache" 4 .IX Item "shared_cache, double_cache" Not planned at the moment .IP "blind_cache" 4 .IX Item "blind_cache" Not sure if I should implement. In \s-1HTC\s0 you have the possibility to set the expire time of the templates (after that time in memory the template file is rechecked if it has changed), so setting a very high value for expire_time would have the same effect as blind_cache. See \*(L"\s-1CACHING\*(R"\s0 \f(CW\*(C`expire_time\*(C'\fR .IP "double_file_cache" 4 .IX Item "double_file_cache" If I understand correctly, in \s-1HT,\s0 this enables memory and file cache at the same time. In \s-1HTC,\s0 this is not needed. If you use file_cache and cache, both are used. .IP "file_cache_dir_mode" 4 .IX Item "file_cache_dir_mode" Not planned. The cache dir must exist, and subdirectories are not created at the moment. .IP "cache_lazy_vars, cache_lazy_loops" 4 .IX Item "cache_lazy_vars, cache_lazy_loops" Not planned at the moment (This would be for HTML::Template::Compiled::Classic, since it implements code refs). .IP "utf8" 4 .IX Item "utf8" Might be added in the future, \s-1HTC\s0 already has \f(CW\*(C`open_mode\*(C'\fR .IP "various debug options" 4 .IX Item "various debug options" Might be implemented in the future .IP "associate" 4 .IX Item "associate" Not planned. .IP "max_includes" 4 .IX Item "max_includes" Not planned .IP "die_on_missing_include" 4 .IX Item "die_on_missing_include" Maybe .PP \fI\s-1DIFFERENT FEATURES\s0\fR .IX Subsection "DIFFERENT FEATURES" .IP "case_sensitive" 4 .IX Item "case_sensitive" default is 1 (on). .Sp Deactivate by passing option case_sensitive 0. .Sp Note (again): this will slow down templating a lot (50%). .Sp Explanation: This has nothing to do with \f(CW\*(C`TMPL_IF\*(C'\fR or \f(CW\*(C`tmpl_if\*(C'\fR. It's about the variable names. With case_sensitive set to 1, the following tags are different: .Sp .Vb 2 \& prints the value of hash key \*(AqFoo\*(Aq \& prints the value of hash key \*(AqfOO\*(Aq .Ve .Sp With case_sensitive set to 0, all your parameters passed to \f(CW\*(C`param()\*(C'\fR are converted to lowercase, and the following tags are the same: .Sp .Vb 2 \& prints the value of hash key \*(Aqfoo\*(Aq \& prints the value of hash key \*(Aqfoo\*(Aq .Ve .IP "subref variables" 4 .IX Item "subref variables" As of version 0.69, subref variables are not supported any more with HTML::Template::Compiled. Use HTML::Template::Compiled::Classic (contained in this distribution) instead. It provides most features of \s-1HTC.\s0 .IP "search_path_on_include" 4 .IX Item "search_path_on_include" Default: 0 .Sp In the HTML::Template documentation it says, if search_path_on_include is set to 1, the paths of the path option are searched, while the default behaviour is to look \*(L"only\*(R" in the current template directory. .Sp It's not clear if it still searches in the current directory if set to 1. I found out that it is not, so you cannot have both. .Sp In HTML::Template::Compiled, search_path_on_include can have three values: 0: search current template directory 1: search paths specified 2: search paths and current template directory. .IP "open_mode" 4 .IX Item "open_mode" In \s-1HTC\s0 you should leave out the \f(CW\*(C`<\*(C'\fR at the beginning. .Sp If you want to have your templates read in utf\-8, use .Sp .Vb 1 \& open_mode => \*(Aq:encoding(utf\-8)\*(Aq, .Ve .Sp as an option. .IP "use_query" 4 .IX Item "use_query" default is 0 (off). Set it via the option \&\f(CW\*(C`use_query\*(C'\fR .IP "Arrayrefs" 4 .IX Item "Arrayrefs" At the moment this snippet .Sp .Vb 1 \& truefalse .Ve .Sp with this code: .Sp .Vb 1 \& $htc\->param(arrayref => []); .Ve .Sp will print true in \s-1HTC\s0 and false in HTML::Template. In HTML::Template an array is true if it has content, in \s-1HTC\s0 it's true if it (the reference) is defined. I'll try to find a way to change that behaviour, though that might be for the cost of speed. .Sp As of HTML::Template::Compiled 0.85 you can use this syntax: .Sp .Vb 1 \& truefalse .Ve .Sp In HTML::Template::Compiled::Classic 0.04 it works as in HTML::Template. .IP "debug_cache" 4 .IX Item "debug_cache" Additional to 0 or 1 it can take an array ref for debugging only specific cache operations. .PP Note: the following is deprecated: .PP .Vb 1 \& To be compatible in all of the above options all use: \& \& use HTML::Template::Compiled compatible => 1; \& \& If you don\*(Aqt care about these options you should use \& \& use HTML::Template::Compiled speed => 1; \& \& which is the default but depending on user wishes that might change. .Ve .SS "\s-1DEPRECATED\s0" .IX Subsection "DEPRECATED" .IP "class methods ExpireTime, EnableSub, CaseSensitive, SearchPathOnInclude, UseQuery" 4 .IX Item "class methods ExpireTime, EnableSub, CaseSensitive, SearchPathOnInclude, UseQuery" .PD 0 .IP "option formatter_path" 4 .IX Item "option formatter_path" .IP "tag \s-1USE_VARS,\s0 not needed anymore" 4 .IX Item "tag USE_VARS, not needed anymore" .IP "option cache_dir (replaced by file_cache_dir)" 4 .IX Item "option cache_dir (replaced by file_cache_dir)" .IP "options method_call, deref, default_path, dumper" 4 .IX Item "options method_call, deref, default_path, dumper" .IP "import tags short, compatible, speed" 4 .IX Item "import tags short, compatible, speed" .PD .SS "\s-1ESCAPING\s0" .IX Subsection "ESCAPING" Like in HTML::Template, you have \f(CW\*(C`ESCAPE=HTML\*(C'\fR, \f(CW\*(C`ESCAPE=URL\*(C'\fR and \f(CW\*(C`ESCAPE_JS\*(C'\fR. \&\f(CW\*(C`ESCAPE=HTML\*(C'\fR will only escape '"&<>. If you want to escape more, use \&\f(CW\*(C`ESCAPE=HTML_ALL\*(C'\fR. Additionally you have \f(CW\*(C`ESCAPE=DUMP\*(C'\fR, which by default will generate a Data::Dumper output. .PP You can also chain different escapings, like \f(CW\*(C`ESCAPE=DUMP|HTML\*(C'\fR. .PP Additionally to ESCAPE=JS you have ESCAPE=IJSON which does not escape the single quote. .SS "\s-1INCLUDE\s0" .IX Subsection "INCLUDE" Additionally to .PP .Vb 1 \& .Ve .PP you can do an include of a template variable: .PP .Vb 2 \& \& $htc\->param(file_include_var => "file.htc"); .Ve .PP Using \f(CW\*(C`INCLUDE VAR="..."\*(C'\fR is deprecated. .PP You can also include strings: .PP .Vb 2 \& template: \& inc: <%include_string foo %> \& \& code: \& $htc\->param( \& foo => \*(Aqincluded=<%= bar%>\*(Aq, \& bar => \*(Aqreal\*(Aq, \& ); \& \& output: \& inc: included=real .Ve .PP Note that included strings are not cached and cannot include files or strings themselves. .SS "\s-1EXTENDED VARIABLE ACCESS\s0" .IX Subsection "EXTENDED VARIABLE ACCESS" With \s-1HTC,\s0 you have more control over how you access your template parameters. An example: .PP .Vb 10 \& my %hash = ( \& SELF => \*(Aq/path/to/script.pl\*(Aq, \& LANGUAGE => \*(Aqde\*(Aq, \& BAND => \*(AqBauhaus\*(Aq, \& ALBUMS => [ \& { \& NAME => \*(AqMask\*(Aq, \& SONGS => [ { NAME => \*(AqHair of the Dog\*(Aq }, ... ], \& }, \& ], \& INFO => { \& BIOGRAPHY => \*(Aq...\*(Aq, \& LINK => \*(Aq...\*(Aq \& }, \& NAME => "Cool script", \& ); .Ve .PP Now in the \s-1TMPL_LOOP\s0 \f(CW\*(C`ALBUMS\*(C'\fR you would like to access the path to your script, stored in \f(CW$hash\fR{\s-1SELF\s0}. in HTML::Template you have to set the option \f(CW\*(C`global_vars\*(C'\fR, so you can access \f(CW$hash{SELF}\fR from everywhere. Unfortunately, now \f(CW\*(C`NAME\*(C'\fR is also global, which might not a problem in this simple example, but in a more complicated template this is impossible. With \s-1HTC,\s0 you wouldn't use \f(CW\*(C`global_vars\*(C'\fR here, but you can say: .PP .Vb 1 \& .Ve .PP to access the root element, and you could even say \f(CW\*(C`.INFO.BIOGRAPHY\*(C'\fR or \f(CW\*(C`ALBUMS[0].SONGS[0].NAME\*(C'\fR (the latter has changed since version 0.79) .SS "\s-1RENDERING OBJECTS\s0" .IX Subsection "RENDERING OBJECTS" This is still in development, so I might change the \s-1API\s0 here. .PP Additionally to feeding a simple hash to \s-1HTC,\s0 you can feed it objects. To do method calls you can also use '.' in the template. .PP .Vb 3 \& my $htc = HTML::Template::Compiled\->new( \& ... \& ); \& \& $htc\->param( \& VAR => "blah", \& OBJECT => bless({...}, "Your::Class"), \& ); \& \& \& \& Name: \& .Ve .PP \&\f(CW\*(C`fullname\*(C'\fR will call the fullname method of your Your::Class object. .PP It's recommended to just use the default . value for methods and dereferencing. .PP I might stop supporting that you can set the values for method calls by setting an option. Ideally I would like to have that behaviour changed only by inheriting. .SS "\s-1RUNNING PERL WITH TMPL_PERL\s0" .IX Subsection "RUNNING PERL WITH TMPL_PERL" Yes, templating systems are for separating code and templates. But as it turned out to be implemented much easier than expressions i decided to implement it. But expressions are also available with the option \&\f(CW\*(C`use_expressions\*(C'\fR. .PP Note: If you have templates that can be edited by untrustworthy persons then you don't want them to include perl code. .PP So, how do you use the perl-tag? First, you have to set the option \&\f(CW\*(C`use_perl\*(C'\fR to \f(CW1\fR when creating a template object. .PP Important note: don't use \f(CW\*(C`print\*(C'\fR in the included code. Usually the template code is concatenated and returned to your perl script. To 'print' something out use .PP .Vb 1 \& _\|_OUT_\|_ 2**3; .Ve .PP This will be turned into something like .PP .Vb 3 \& $OUT .= 2**3; \& # or \& print $fh 2**3; .Ve .PP Important note 2: \s-1HTC\s0 does not parse Perl. if you use the classic tag-delimiters like this: .PP .Vb 1 \& count > 42) { > .Ve .PP this will not work as it might seem. Use other delimiters instead: .PP .Vb 1 \& <%perl if (_\|_CURRENT_\|_\->count > 42) { %> .Ve .PP Example: .PP .Vb 5 \& \& \& \& \& \& \& # takes the current position of the parameter \& # hash, key \*(Aqfoo\*(Aq and multiplies it with 3 \& <%perl _\|_OUT_\|_ _\|_CURRENT_\|_\->{foo} * 3; %> .Ve .PP List of special keywords inside a perl-tag: .IP "_\|_OUT_\|_" 4 .IX Item "__OUT__" Is turned into \f(CW\*(C`$OUT .=\*(C'\fR or \f(CW\*(C`print $fh\*(C'\fR .IP "_\|_HTC_\|_" 4 .IX Item "__HTC__" Is turned into the variable containing the current template object. .IP "_\|_CURRENT_\|_" 4 .IX Item "__CURRENT__" Turned into the variable containing the current position in the parameter hash. .IP "_\|_ROOT_\|_" 4 .IX Item "__ROOT__" Turned into the variable containing the parameter hash. .IP "_\|_INDEX_\|_" 4 .IX Item "__INDEX__" Turned into the current index of a loop (starting with 0). .SS "\s-1INHERITANCE\s0" .IX Subsection "INHERITANCE" It's possible since version 0.69 to inherit from HTML::Template::Compiled. It's just not documented, and internal method names might change in the near future. I'll try to fix the \s-1API\s0 and document which methods you can inherit. .PP \fI\s-1METHODS TO INHERIT\s0\fR .IX Subsection "METHODS TO INHERIT" .IP "method_call" 4 .IX Item "method_call" Default is \f(CW\*(C`sub method_call { \*(Aq.\*(Aq }\*(C'\fR .IP "deref" 4 .IX Item "deref" Default is \f(CW\*(C`sub deref { \*(Aq.\*(Aq }\*(C'\fR .IP "formatter_path" 4 .IX Item "formatter_path" Deprecated, see HTML::Template::Compiled::Formatter please. .IP "compile_early" 4 .IX Item "compile_early" Define if every included file should be checked and parsed at compile time of the including template or later when it is really used. .Sp Default is \f(CW\*(C`sub compile_early { 1 }\*(C'\fR .IP "parser_class" 4 .IX Item "parser_class" Default is \f(CW\*(C`sub parser_class { \*(AqHTML::Template::Compiled::Parser\*(Aq }\*(C'\fR .Sp You can write your own parser class (which must inherit from HTML::Template::Compiled::Parser) and use this. .Sp HTML::Template::Compiled::Lazy uses this. .SS "\s-1DEBUGGING\s0" .IX Subsection "DEBUGGING" For printing out the contents of all the parameters you can do: .PP .Vb 3 \& \& Dump: \& .Ve .PP The special name \f(CW\*(C`_\*(C'\fR gives you the current parameter and \f(CW\*(C`ESCAPE=DUMP\*(C'\fR will by default generate a Data::Dumper output of the current variable, in this case it will dump out the contents of every album in a loop. To correctly display that in html \f(CW\*(C`|HTML\*(C'\fR will escape html entities. .SS "\s-1TMPL_WITH\s0" .IX Subsection "TMPL_WITH" If you have a deep leveled hash you might not want to always write \&\s-1THE.FULL.PATH.TO.YOUR.VAR.\s0 Jump to your desired level once and then you need only one level. Compare: .PP .Vb 3 \& \& : \& \& \& : .Ve .PP Inside \s-1TMPL_WITH\s0 you can't reference parent nodes unless you're using global_vars. .SS "\s-1TMPL_LOOP\s0" .IX Subsection "TMPL_LOOP" The special name \f(CW\*(C`_\*(C'\fR gives you the current parameter. In loops you can use it like this: .PP .Vb 3 \& \& Current item: \& .Ve .PP Also you can give the current item an alias. See \*(L"\s-1ALIAS\*(R"\s0. .PP The \s-1LOOP\s0 tag allows you to define a \s-1JOIN\s0 attribute: .PP .Vb 3 \& \& \& .Ve .PP This will output something like \f(CW\*(C`blue, pink, yellow\*(C'\fR. This is easier than doing: .PP .Vb 4 \& \& , \& \& .Ve .PP The \f(CW\*(C`LOOP\*(C'\fR, \f(CW\*(C`WHILE\*(C'\fR and \f(CW\*(C`EACH\*(C'\fR tags allow you to define a \s-1BREAK\s0 attribute: .PP .Vb 1 \& \en \& \& $htc\->param(bingo => [qw(X 0 _ _ X 0 _ _ X)]); .Ve .PP outputs .PP .Vb 3 \& X 0 _ \& _ X 0 \& _ _ X .Ve .PP So specifying BREAK=3 sets _\|_break_\|_ to 1 every 3rd loop iteration. .PP \&\s-1TMPL_LOOP\s0 expects an array reference, also if it is a method call. If you want to iterate with \s-1TMPL_LOOP\s0 over a list from a method call, set the attribute \f(CW\*(C`context=list\*(C'\fR: .PP .Vb 3 \& \& \& .Ve .SS "\s-1TMPL_WHILE\s0" .IX Subsection "TMPL_WHILE" Useful for iterating, for example over database resultsets. The directive .PP .Vb 3 \& \& \& .Ve .PP will work like: while (my \f(CW$row\fR = \f(CW$resultset\fR\->fetchrow) { print \f(CW$row\fR\->[0]; } .PP So the special variable name _ is set to the current item returned by the iterator. .PP You also can use \*(L"\s-1ALIAS\*(R"\s0 here. .SS "\s-1TMPL_EACH\s0" .IX Subsection "TMPL_EACH" Iterating over a hash. Internally it is not implemented as an each, so you can also sort the output: .PP .Vb 10 \& Sorted alphanumerically by default (since 0.93): \& \& : \& \& Sorted numerically: \& \& : \& \& Not sorted: \& \& : \& \& Sorted alphanumerically: \& \& : \& .Ve .PP You have to set the option \f(CW\*(C`loop_context_vars\*(C'\fR to true to use the special vars \f(CW\*(C`_\|_key_\|_\*(C'\fR and \f(CW\*(C`_\|_value_\|_\*(C'\fR. .PP If you want to iterate over a hash instead of a hashref (some methods might return plain hashes instead of references and \&\s-1TMPL_EACH\s0 expects a ref), then you can set \f(CW\*(C`context=list\*(C'\fR: .PP .Vb 3 \& \& \& .Ve .PP Since 1.000_001 you can also define by which variable you want to sort. If you have a hash with hashes as values: .PP .Vb 11 \& $htc\->param( \& letters => { \& 1 => { letter =>\*(Aqb\*(Aq }, \& 2 => { letter =>\*(Aqa\*(Aq }, \& 3 => { letter =>\*(Aqc\*(Aq }, \& }, \& ); \& <%each letters sort=alpha sortby="letter" %> \& <%set_var val value=_\|_value_\|_ %> \& <%= _\|_key_\|_ %> = <%= $val.letter %> \& <%/each%> .Ve .SS "\s-1SET_VAR\s0" .IX Subsection "SET_VAR" Since 0.96_002 .PP Sets a local variable to the value given in \f(CW\*(C`value\*(C'\fR or \f(CW\*(C`expr\*(C'\fR .PP .Vb 7 \& \& \& \& \& \& \& ... .Ve .PP \&\f(CW\*(C`value=..\*(C'\fR behaves like a variable name from the parameter stash. The variable name to set must match /[0\-9a\-z_]+/i .PP You can refer to an alias via \f(CW$alias\fR or simply \f(CW\*(C`alias\*(C'\fR. Note that the latter syntax is not recommended any more since it can conflict with parameters from the stash. .PP If you want to use aliases in includes, you need to use the \f(CW$alias\fR syntax. .SS "\s-1USE_VARS\s0" .IX Subsection "USE_VARS" deprecated. Was added in 0.96_004 to make it possible to use aliases set with \f(CW\*(C`alias=...\*(C'\fR or \f(CW\*(C`SET_VAR\*(C'\fR in includes. Now you should rather use the <$alias> syntax. .PP The following explanation is just there for history and will be removed some time in the future. For now it still works. .PP Necessary if you want vars like \s-1SET_VAR\s0 and loop aliases from outside in includes. Before the first use in the include, add: .PP .Vb 1 \& .Ve .PP so that the compiler recognizes them as user defined vars and not parameters from the stash. This statement is valid until the end of the template so you cannot \&\*(L"overwrite\*(R" parameters of the stash locally. .SS "\s-1WRAPPER\s0" .IX Subsection "WRAPPER" Since 0.97_005. Experimental. Please test. .PP Needs option \f(CW\*(C`loop_context_vars\*(C'\fR. .PP Works similar to \s-1WRAPPER\s0 in Template-Toolkit. .PP Is similar to \s-1TMPL_INCLUDE,\s0 just that the included wrapper is wrapped around the content. It can be used to avoid including head and foot separately. .PP .Vb 3 \& \& content: some var: \& .Ve .PP In wrapper.html the special loop context var \f(CW\*(C`_\|_wrapper_\|_\*(C'\fR is used for the included content: .PP .Vb 4 \& wrapper.html: \& \& \& .Ve .PP Important notes: .PP If you are using \f(CW\*(C`out_fh\*(C'\fR to print directly to a filehandle instead of returning to a string, this feature might not be useful, since it is appending the content inside of the wrapper to a string and prints it when it comes to the end of the wrapper tag. So if you are using \f(CW\*(C`out_fh\*(C'\fR to avoid generating long strings in memory, you should rather use \s-1TMPL_INCLUDE\s0 instead. .PP Also you need perl 5.8 or higher to use it in combination with out_fh. .SS "\s-1TMPL_COMMENT\s0" .IX Subsection "TMPL_COMMENT" For debugging purposes you can temporarily comment out regions: .PP .Vb 8 \& Wanted: \& \& this won\*(Aqt be printed \& \& \& \& \& \& \& $htc\->param(unwanted => "no thanks", wanted => "we want this"); .Ve .PP The output is (whitespaces stripped): .PP .Vb 1 \& Wanted: we want this .Ve .PP \&\s-1HTC\s0 will ignore anything between \s-1COMMENT\s0 directives. This is useful for debugging, and also for documentation inside the template which should not be outputted. .SS "\s-1TMPL_NOPARSE\s0" .IX Subsection "TMPL_NOPARSE" Anything between .PP .Vb 1 \& ... .Ve .PP will not be recognized as template directives. Same syntax as \s-1TMPL_COMMENT.\s0 It will output the content, though. .SS "\s-1TMPL_VERBATIM\s0" .IX Subsection "TMPL_VERBATIM" Anything between .PP .Vb 1 \& ... .Ve .PP will not be recognized as template directives. Same syntax as \&\*(L"\s-1TMPL_NOPARSE\*(R"\s0, but it will be HTML-Escaped. This can be useful for debugging. .SS "\s-1TMPL_SWITCH\s0" .IX Subsection "TMPL_SWITCH" The \s-1SWITCH\s0 directive has the same syntax as \s-1VAR, IF\s0 etc. The \s-1CASE\s0 directive takes a simple string or a comma separated list of strings. Yes, without quotes. This will probably change! I just don't know yet how it should look like. Suggestions? .PP With that directive you can do simple string comparisons. .PP .Vb 8 \& (or ) \& echt cool \& very cool \& superculo \& don\*(Aqt speak french or swedish \& sorry, no translation for cool in language <%=language%> available \& (same as default) \& .Ve .PP It's also possible to specify the default with a list of other strings: .PP .Vb 1 \& .Ve .PP Note that the default case should always be the last statement before the closing switch. .SS "\s-1OPTIONS\s0" .IX Subsection "OPTIONS" As you can cache the generated perl code in files, some of the options are fixed; that means for example if you set the option case_sensitive to 0 and the next time you call the same template with case_sensitive 1 then this will be ignored. The options below will be marked as (fixed). .IP "path" 4 .IX Item "path" Path to template files .IP "search_path_on_include" 4 .IX Item "search_path_on_include" Search the list of paths specified with \f(CW\*(C`path\*(C'\fR when including a template. Default is 0 .Sp See \*(L"\s-1DIFFERENT FEATURES\*(R"\s0 for the additional possible value 2. .IP "file_cache" 4 .IX Item "file_cache" Set to 1 if you want to use file caching and specify the path with file_cache_dir. .IP "file_cache_dir" 4 .IX Item "file_cache_dir" Path to caching directory (you have to create it before) .IP "cache_dir" 4 .IX Item "cache_dir" Replaced by file_cache_dir like in HTML::Template. Will be deprecated in future versions. .IP "cache" 4 .IX Item "cache" Is 1 by default. If set to 0, no memory caching is done. Only recommendable if you have a dynamic template content (with scalarref, arrayre for example). .IP "expire_time" 4 .IX Item "expire_time" Recheck template files on disk after \f(CW\*(C`expire_time\*(C'\fR seconds. See \*(L"\s-1CACHING\*(R"\s0 .IP "filename" 4 .IX Item "filename" Template to parse .IP "scalarref" 4 .IX Item "scalarref" Reference to a scalar with your template content. It's possible to cache scalarrefs, too, if you have Digest::MD5 installed. Note that your cache directory might get filled with files from earlier versions. Clean the cache regularly. .Sp Don't cache scalarrefs if you have dynamic strings. Your memory might get filled up fast! Use the option .Sp .Vb 1 \& cache => 0 .Ve .Sp to disable memory caching. .IP "arrayref" 4 .IX Item "arrayref" Reference to array containing lines of the template content (newlines have to be included) .IP "filehandle" 4 .IX Item "filehandle" Filehandle which contains the template content. Note that \s-1HTC\s0 will not cache templates created like this. .IP "loop_context_vars (fixed)" 4 .IX Item "loop_context_vars (fixed)" Vars like \f(CW\*(C`_\|_first_\|_\*(C'\fR, \f(CW\*(C`_\|_last_\|_\*(C'\fR, \f(CW\*(C`_\|_inner_\|_\*(C'\fR, \f(CW\*(C`_\|_odd_\|_\*(C'\fR, \f(CW\*(C`_\|_counter_\|_\*(C'\fR, \&\f(CW\*(C`_\|_index_\|_\*(C'\fR, \f(CW\*(C`_\|_outer_\|_\*(C'\fR, \f(CW\*(C`_\|_even_\|_\*(C'\fR .Sp The variable \f(CW\*(C`_\|_index_\|_\*(C'\fR works just like \f(CW\*(C`_\|_counter_\|_\*(C'\fR, only that it starts at 0 instead of 1. .IP "global_vars (fixed)" 4 .IX Item "global_vars (fixed)" If set to 1, every outer variable can be accessed from anywhere in the enclosing scope. .Sp Default is 0. .Sp Note that I don't recommend using global_vars. For referring to parameters up in the stash you can use aliases via \f(CW\*(C`alias=...\*(C'\fR or \f(CW\*(C`SET_VAR\*(C'\fR. See \*(L"\s-1ALIAS\*(R"\s0 and \*(L"\s-1SET_VAR\*(R"\s0. .Sp If you still would like to be able to navigate up the parameter stash, you have the following option: .Sp If set to 2, you don't have global vars, but have the possibility to go up the stack one level. Example: .Sp .Vb 1 \& .Ve .Sp This will get you up 2 levels (remember: one dot means root in \s-1HTC\s0) and access the 'key' element. .Sp If set to 3 (\f(CW\*(C`3 == 1|2\*(C'\fR) you have both, global vars and explicitly going up the stack. .Sp So setting global_vars to 2 can save you from global vars but still allows you to browse through the stack. .IP "default_escape" 4 .IX Item "default_escape" .Vb 4 \& my $htc = HTML::Template::Compiled\->new( \& ... \& default_escape => \*(AqHTML\*(Aq, # or URL \& ); .Ve .Sp Now everything will be escaped for \s-1HTML\s0 unless you explicitly specify \f(CW\*(C`ESCAPE=0\*(C'\fR (no escaping) or \f(CW\*(C`ESCAPE=URL\*(C'\fR. .IP "strict (since 0.97_001)" 4 .IX Item "strict (since 0.97_001)" Default: 1 .Sp If set to 0 unknown tags will be ignored and output verbatim: .Sp .Vb 1 \& .Ve .IP "line_info (fixed) (since 1.000_004)" 4 .IX Item "line_info (fixed) (since 1.000_004)" Default: 0 .Sp .Vb 4 \& my $htc = HTML::Template::Compiled\->new( \& ... \& line_info => 1, # default 0 \& ); .Ve .Sp If any runtime errors occur, line information will output the template filename and line (instead of \*(L"eval\*(R" and the generated perl code line) .IP "warnings (fixed) (since 1.000_004)" 4 .IX Item "warnings (fixed) (since 1.000_004)" Default: 0 .Sp If set to 1, runtime warnings (like use of uninitialized value) will be output to stderr. .Sp If set to 'fatal', any runtime warning will cause the script to die. .IP "no_includes (since 0.92)" 4 .IX Item "no_includes (since 0.92)" Default is 0. If set to 1, the tags \s-1INCLUDE, INCLUDE_VAR\s0 and \s-1INCLUDE_STRING\s0 will cause a template syntax error when creating. This can be useful when opening untrusted templates, otherwise any file in the filesystem could be opened. .IP "debug_file (fixed) (since 0.91_001)" 4 .IX Item "debug_file (fixed) (since 0.91_001)" Additionally to the context_vars _\|_filename_\|_ and _\|_filenameshort_\|_ you can enable filename debugging globally. .Sp If the option is set to 'start', at the start of every template will be added: .Sp If set to 'end', at the end will be added: .Sp If set to 'start,end', both comments will be added. .Sp If set to 'start,short', 'end,short' or 'start,end,short' the path to the templates will be stripped: .IP "optimize (fixed) (since 1.001_001)" 4 .IX Item "optimize (fixed) (since 1.001_001)" Hashref with compiler hints. .Sp Every access to the parameter stash has to check if the current var is an object or a hash. This allows you to use the same notation for hash accesses and method calls without caring about the data. But this is quite expensive. You can give the compiler hints: .Sp .Vb 6 \& HTML::Template::Compiled\->new( \& optimize => { \& initial_var => 1, # defaults \& object_check => 0, \& root_hash => 0, \& }, .Ve .RS 4 .IP "initial_var" 4 .IX Item "initial_var" Default: 1 .Sp Might become a default in the code itself and removed as an option. Report if you have problems and set it to 0. This is just a minor internal optimization for variable accesses like \&\f(CW\*(C`[%= foo.bar.baz %]\*(C'\fR .IP "object_check" 4 .IX Item "object_check" Default: 0 .Sp If you are in a loop and make several accesses to the same var, it always checks if it is an object or not: .Sp .Vb 6 \& [%loop threads %] \& [%= id %] \& [%= title %] \& [%= ctime %] \& ... \& [%/loop threads %] .Ve .Sp If you set this to true, the check will be done at the beginning of the loop and saved into a variable, so that subsequent accesses only use the check variable. Same for \s-1TMPL_WITH, TMPL_WHILE.\s0 .Sp If you only have one access in a loop, this might be unnecessary overhead. Also, theoretically, a variable can change during calls. .Sp In the most cases this option should be fine. I will set the default to 1 someday probably. .IP "root_hash" 4 .IX Item "root_hash" It is possible to pass an object to \fBparam()\fR instead of a hash. So even every access to the root of the parameter stash has to check if it is an object or a hashref. In the most cases the parameter stash is a hashref. If you are sure that you always have a parameter hash and activate this option, the compiler can avoid this check. .RE .RS 4 .RE .IP "objects (fixed) (since 0.91_001)" 4 .IX Item "objects (fixed) (since 0.91_001)" if set to true, you can use method calls like <%= object.method %> .Sp Default is 'strict' (true). If set to 'strict', the method will be called if we have an object, otherwise it's treated as a hash lookup. If the method doesn't exist, it dies. If set to 'nostrict', the method will be called only if the object 'can' do the method, otherwise it will return undef (this will need Scalar::Util). If set to 0, no method calls are allowed. .IP "deref (fixed)" 4 .IX Item "deref (fixed)" Deprecated. Please inherit and overwrite method 'deref'. See \*(L"\s-1INHERITANCE\*(R"\s0 .Sp Define the string you want to use for dereferencing, default is \f(CW\*(C`.\*(C'\fR at the moment: .Sp .Vb 1 \& .Ve .IP "method_call (fixed)" 4 .IX Item "method_call (fixed)" Deprecated. Please inherit and overwrite method 'method_call'. See \*(L"\s-1INHERITANCE\*(R"\s0 .Sp Define the string you want to use for method calls, default is . at the moment: .Sp .Vb 1 \& .Ve .Sp Don't use \->, though, like you could in earlier version. Var names can contain: Numbers, letters, '.', '/', '+', '\-' and '_', just like HTML::Template. Note that if your var names contain dots, though, they will be treated as hash dereferences. If you want literal dots, use HTML::Template::Compiled::Classic instead. .IP "default_path (fixed)" 4 .IX Item "default_path (fixed)" Deprecated, see HTML::Template::Compiled::Formatter please. .Sp .Vb 6 \& my $htc = HTML::Template::Compiled\->new( \& ... \& default_path \& # default is PATH_DEREF \& => HTML::Template::Compiled::Utils::PATH_FORMATTER, \& ); .Ve .Sp Is needed if you have an unqualified tmpl_var that should be resolved as a call to your formatter, for example. Otherwise you have to call it fully qualified. If your formatter_path is '/', you'd say tmpl_var \f(CW\*(C`_/method\*(C'\fR. With the option default_path you can make that the default, so you don't need the \f(CW\*(C`_/\*(C'\fR: \f(CW\*(C`tmpl_var method\*(C'\fR. If you don't use formatters, don't care about this option. .IP "line_numbers" 4 .IX Item "line_numbers" \&\s-1NOTE:\s0 This option does not exist any more; line numbers will always be reported. .Sp For debugging: prints the line number of the wrong tag, e.g. if you have a /TMPL_IF that does not have an opening tag. .IP "case_sensitive (fixed)" 4 .IX Item "case_sensitive (fixed)" default is 1, set it to 0 to use this feature like in HTML::Template. Note that this can slow down your program a lot (50%). .IP "dumper" 4 .IX Item "dumper" This option is deprecated as of version 0.76. You must now use a plugin instead, like HTML::Template::Compiled::Plugin::DHTML, for example. .Sp .Vb 6 \& my $t = HTML::Template::Compiled\->new( \& ... \& dumper = sub { my_cool_dumper($_[0]) }, \& ); \& \-\-\- \& .Ve .Sp This will call \f(CW\*(C`my_cool_dumper()\*(C'\fR on \f(CW\*(C`var\*(C'\fR. .Sp Alternatively you can use the \s-1DHTML\s0 plugin which is using \f(CW\*(C`Data::TreeDumper\*(C'\fR and \&\f(CW\*(C`Data::TreeDumper::Renderer::DHTML\*(C'\fR. You'll get a dumper like output which you can collapse and expand, for example. See Data::TreeDumper and Data::TreeDumper::Renderer::DHTML for more information. Example: .Sp .Vb 4 \& my $t = HTML::Template::Compiled\->new( \& ... \& dumper = \*(AqDHTML\*(Aq, \& ); .Ve .Sp For an example see \f(CW\*(C`examples/dhtml.html\*(C'\fR. .IP "out_fh (fixed)" 4 .IX Item "out_fh (fixed)" .Vb 6 \& my $t = HTML::Template::Compiled\->new( \& ... \& out_fh => 1, \& ); \& ... \& $t\->output($fh); # or output(\e*STDOUT) or even output() .Ve .Sp This option is fixed, so if you create a template with \f(CW\*(C`out_fh\*(C'\fR, every output of this template will print to a specified (or default \f(CW\*(C`STDOUT\*(C'\fR) filehandle. .IP "filter" 4 .IX Item "filter" Filter template code before parsing. .Sp .Vb 11 \& my $t = HTML::Template::Compiled\->new( \& ... \& filter => sub { myfilter( ${$_[0]} ) }, \& # or \& filter => [ { \& sub => sub { myfilter( ${$_[0]} ) }, \& format => \*(Aqscalar\*(Aq, # or array \& }, \& ... \& ], \& ); .Ve .IP "tagstyle (fixed)" 4 .IX Item "tagstyle (fixed)" Specify which styles you want to use. This option takes an arrayref with strings of named tagstyles or your own regexes. .Sp At the moment there are the following named tagstyles builtin: .Sp .Vb 2 \& # classic (active by default) \& \& \& # comment (active by default) \& \& \& # asp (active by default) \& <%if foo%><%VAR bar%><%/if%> \& \& # php (not active by default) \& \& \& # tt (not active by default) \& [%if foo%][%var bar%][%/if foo%] .Ve .Sp You deactivate a style by saying \-stylename. You activate by saying +stylename. .Sp Define your own tagstyle by specifying regexes. For example you want to use {\f(CW\*(C`{{if foo}}{{var bar}}{{/if foo}}\*(C'\fR, then your definition should be: .Sp .Vb 6 \& [ \& qr({{), # start of opening tag \& qr(}}), # end of opening tag \& qr({{/), # start of closing tag \& qr(}}), # end of closing tag \& ] .Ve .Sp \&\s-1NOTE:\s0 do not specify capturing parentheses in you regexes. If you need parentheses, use \f(CW\*(C`(?:foo|bar)\*(C'\fR instead of \f(CW\*(C`(foo|bar)\*(C'\fR. .Sp Say you want to deactivate asp-style, comment-style, activate php\- and tt-style and your own \f(CW\*(C`{{}} \*(C'\fR style, then say: .Sp .Vb 7 \& my $htc = HTML::Template::Compiled\->new( \& ... \& tagstyle => [ \& qw(\-asp \-comment +php +tt), \& [ qr({{), qr(}}), qr({{/), qr(}})], \& ], \& ); .Ve .IP "use_expressions (since 0.91_003)" 4 .IX Item "use_expressions (since 0.91_003)" Set to 1 if you want to use expressions. The basic expressions work more or less like in HTML::Template::Expr \- I took the parsing code from it and used it with some minor changes \- thanks to Sam Tregar. .Sp .Vb 1 \& <%if expr="some.var > 3" %>It\*(Aqs grater than 3<%/if %> .Ve .Sp But with expressions you can also use more complex navigation through the template stash: .Sp You can use object methods with parameters. While a normal method call can only be called without parameters, like .Sp .Vb 1 \& <%= object.name %> .Ve .Sp with expressions you can give it parameters: .Sp .Vb 1 \& <%= expr="object.create_link(\*(Aqnavi\*(Aq)" %> .Ve .Sp Inside function and method calls, hash keys you also can use template vars (array indices and hash keys since 0.96_003). .Sp .Vb 2 \& <%= expr=".path.to.hash{var}" %> \& <%= expr=".path.to.hash{.another.var[123]}{\*(Aqliteral key\*(Aq}" %> .Ve .Sp It is only minimally tested yet, so use with care and please report any bugs you find. .Sp A useful example: Output a number of items with their prices formatted. .Sp .Vb 12 \& my $nf = Number::Format\->new(...); \& my $htc = HTML::Template::Compiled\->new( \& filename => \*(Aqitems.html\*(Aq, \& use_expressions => 1, \& ); \& $htc\->param( \& items => [ \& { size => 50 * 1024 * 1024 * 1024, price => 49.95 }, \& { size => 250 * 1024 * 1024 * 1024, price => 110.99 }, \& ], \& nf => $nf, \& ); .Ve .Sp items.html: .Sp .Vb 4 \& <%loop .items %> \& Size: <%= expr=".nf.format_bytes(size)" %> \& Price: <%= expr=".nf.format_price(price)" %> \& <%/loop %> .Ve .Sp Output: Size: 50G Price: 49,95 \s-1EUR\s0 .Sp .Vb 2 \& Size: 250G \& Price: 110,99 EUR .Ve .IP "formatter" 4 .IX Item "formatter" Deprecated, see HTML::Template::Compiled::Formatter please. .Sp With formatter you can specify how an object should be rendered. This is useful if you don't want object methods to be called, but only a given subset of methods. .Sp .Vb 10 \& my $htc = HTML::Template::Compiled\->new( \& ... \& formatter => { \& \*(AqYour::Class\*(Aq => { \& fullname => sub { \& $_[0]\->first . \*(Aq \*(Aq . $_[0]\->last \& }, \& first => Your::Class\->can(\*(Aqfirst\*(Aq), \& last => Your::Class\->can(\*(Aqlast\*(Aq), \& }, \& }, \& ); \& # $obj is a Your::Class object \& $htc\->param(obj => $obj); \& # Template: \& # Fullname: .Ve .IP "formatter_path (fixed)" 4 .IX Item "formatter_path (fixed)" Deprecated, see HTML::Template::Compiled::Formatter please. .IP "debug" 4 .IX Item "debug" If set to 1 you will get the generated perl code on standard error .IP "use_query" 4 .IX Item "use_query" Set it to 1 if you plan to use the \fBquery()\fR method. Default is 0. .Sp Explanation: If you want to use \fBquery()\fR to collect information on the template \s-1HTC\s0 has to do extra-work while compiling and uses extra-memory, so you can choose to save \s-1HTC\s0 work by setting use_query to 0 (default) or letting \s-1HTC\s0 do the extra work by setting it to 1. If you would like 1 to be the default, write me. If enough people write me, I'll think about it =) .IP "use_perl" 4 .IX Item "use_perl" Set to 1 if you want to use the perl-tag. See \*(L"\s-1TMPL_PERL\*(R"\s0. Default is 0. .IP "cache_debug" 4 .IX Item "cache_debug" Default: 0 .Sp You can debug hits and misses for file cache and memory cache: .Sp .Vb 10 \& # debug all cache \& my $htc = HTML::Template::Compiled\->new( \& cache_debug => 1, \& ... \& ); \& # only debug misses \& my $htc = HTML::Template::Compiled\->new( \& cache_debug => [qw/ file_miss mem_miss /], \& ... \& ); .Ve .Sp Possible values when passing an array ref: file_miss file_hit mem_miss mem_hit .Sp Output looks similar to HTML::Template cache_debug and will be output to \s-1STDERR\s0 via \fBwarn()\fR. .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .IP "clear_cache ([\s-1DIR\s0])" 4 .IX Item "clear_cache ([DIR])" Class method. It will clear the memory cache either of a specified cache directory: .Sp .Vb 1 \& HTML::Template::Compiled\->clear_cache($cache_dir); .Ve .Sp or all memory caches: .Sp .Vb 1 \& HTML::Template::Compiled\->clear_cache(); .Ve .IP "clear_filecache" 4 .IX Item "clear_filecache" Class\- or object-method. Removes all generated perl files from a given directory. .Sp .Vb 4 \& # clear a directory \& HTML::Template::Compiled\->clear_filecache(\*(Aqcache_directory\*(Aq); \& # clear this template\*(Aqs cache directory (and not one template file only!) \& $htc\->clear_filecache(); .Ve .IP "param" 4 .IX Item "param" Works like in HTML::Template. .IP "query" 4 .IX Item "query" Works like in HTML::Template. But it is not activated by default. If you want to use it, specify the use_query option. .IP "preload" 4 .IX Item "preload" Class method. Will preload all template files from a given cachedir into memory. Should be done, for example in a mod_perl environment, at server startup, so all templates go into \*(L"shared memory\*(R" .Sp .Vb 1 \& HTML::Template::Compiled\->preload($cache_dir); .Ve .Sp If you don't do preloading in mod_perl, memory usage might go up if you have a lot of templates. .Sp Note: the directory is *not* the template directory. It should be the directory which you give as the file_cache_dir option. .IP "precompile" 4 .IX Item "precompile" Class method. It will precompile a list of template files into the specified cache directory. See \*(L"\s-1PRECOMPILE\*(R"\s0. .IP "clear_params" 4 .IX Item "clear_params" Empty all parameters. .IP "debug_code (since 0.91_003)" 4 .IX Item "debug_code (since 0.91_003)" If you get an error from the generated template, you might want to debug the executed code. You can now call \f(CW\*(C`debug_code\*(C'\fR to get the compiled code and the line the error occurred. Note that the reported line might not be the exact line where the error occurred, also look around the line. The template filename reported does currently only report the main template, not the name of an included template. I'll try to fix that. .Sp .Vb 10 \& local $HTML::Template::Compiled::DEBUG = 1; \& my $htc = HTML::Template::Compiled\->new( \& filename => \*(Aqsome_file_with_runtime_error.html\*(Aq, \& ); \& eval { \& print $htc\->output; \& }; \& if ($@) { \& # reports as text \& my $msg = $htc\->debug_code; \& # reports as a html table \& my $msg_html = $htc\->debug_code(\*(Aqhtml\*(Aq); \& } .Ve .IP "get_plugin" 4 .IX Item "get_plugin" .Vb 1 \& my $plugin = $htc\->get_plugin(\*(AqName::of::plugin\*(Aq); .Ve .Sp Returns the plugin object of that classname. If the plugin is only a string (the classname itself), it returns this string, so this method is only useful for plugin objects. .IP "var2expression" 4 .IX Item "var2expression" Useful for plugins. Parses a template var (\f(CW\*(C`name="foo.bar.baz"\*(C'\fR and returns the perl expression for the compiler. .SH "EXPORT" .IX Header "EXPORT" None. .SH "CACHING" .IX Header "CACHING" You create a template almost like in HTML::Template: .PP .Vb 8 \& my $t = HTML::Template::Compiled\->new( \& path => \*(Aqtemplates\*(Aq, \& loop_context_vars => 1, \& filename => \*(Aqtest.html\*(Aq, \& # for testing without cache comment out \& file_cache => 1, \& file_cache_dir => "cache", \& ); .Ve .PP The next time you start your application and create a new template, \s-1HTC\s0 will read all generated perl files, and a call to the constructor like above won't parse the template, but just use the loaded code. If your template file has changed, though, then it will be parsed again. .PP You can set the expire time of a template by passing the option .PP .Vb 1 \& expire_time => $seconds .Ve .PP Note that .PP .Vb 2 \& HTML::Template::Compiled\->ExpireTime($seconds); \& C<$HTML::Template::Compiled::NEW_CHECK> .Ve .PP are deprecated since they change a global variable which is then visible in the whole process, so in persistent environments other apps might be affected. .PP So an expire time of 600 seconds (default) will check after 10 minutes if the tmpl file was modified. Set it to a very high value will then ignore any changes, until you delete the generated code. For development you should set it to 0, for a pre-production server you can set it to 60 seconds, for example. It can make quite a difference. .SH "PLUGINS" .IX Header "PLUGINS" At the moment you can use and write plugins for the \f(CW\*(C`ESCAPE\*(C'\fR attribute. See HTML::Template::Compiled::Plugin::XMLEscape for an example how to use it; and have a look at the source code if you want to know how to write a plugin yourself. .PP Using Plugins: .PP .Vb 6 \& my $htc = HTML::Template::Compiled\->new( \& ... \& plugin => [\*(AqHTML::Template::Compiled::Foo::Bar\*(Aq], \& # oor shorter: \& plugin => [\*(Aq::Foo::Bar\*(Aq], \& ); .Ve .SH "LAZY LOADING" .IX Header "LAZY LOADING" Let's say you're in a \s-1CGI\s0 environment and have a lot of includes in your template, but only few of them are actually used. HTML::Template::Compiled will (as HTML::Template does) parse all of your includes at once. Just like the \f(CW\*(C`use\*(C'\fR function does in perl. To get a behaviour like require, use HTML::Template::Compiled::Lazy. .SH "TODO" .IX Header "TODO" associate, methods with simple parameters, expressions, pluggable, ... .SH "IMPLEMENTATION" .IX Header "IMPLEMENTATION" \&\s-1HTC\s0 generates a perl subroutine out of every template. Each included template is a subroutine for itself. You can look at the generated code by activating file caching and looking into the cache directory. When you call \f(CW\*(C`output()\*(C'\fR, the subroutine is called. The subroutine either creates a string and adds each template text or the results of the tags to the string, or it prints it directly to a filehandle. Because of the implementation you have to know at creation time of the module if you want to get a string back or if you want to print to a filehandle. .SH "SECURITY" .IX Header "SECURITY" HTML::Template::Compiled uses basically the same file caching model as, for example, Template\- Toolkit does: The compiled Perl code is written to disk and later reread via \f(CW\*(C`do\*(C'\fR or by reading the file and \f(CW\*(C`eval\*(C'\fR the content. .PP If you are sharing a read/write environment with untrusted users (for example on a machine with a webserver, like many webhosters offer, and all scripts are running as the same httpd user), realize that there is possibility of modifying the Perl code that is cached and then executed. The best solution is to not be in such an environment! .PP In this case it is the safest option to generate your compiled templates on a local machine and just put the compiled templates onto the server, with no write access for the http server. Set the \f(CW\*(C`expire_time\*(C'\fR option to a high value so that \s-1HTC\s0 never attempts to check the template timestamp to force a regenerating of the code. .PP If you are alone on the machine, but you are running under taint mode (see perlsec) then you have to explicitly set the \f(CW$UNTAINT\fR variable to 1. \s-1HTC\s0 will then untaint the code for you and treat it as if it were safe (it hopefully is =). .SH "PRECOMPILE" .IX Header "PRECOMPILE" I think there is no way to provide an easy function for precompiling, because every template can have different options. If you have all your templates with the same options, then you can use the precompile class method. It works like this: .PP .Vb 4 \& HTML::Template::Compiled\->precompile( \& # usual options like path, default_escape, global_vars, file_cache_dir, ... \& filenames => [ list of template\-filenames ], \& ); .Ve .PP This will then pre-compile all templates into file_cache_dir. Now you would just put this directory onto the server, and it doesn't need any write-permissions, as it will be never changed (until you update it because templates have changed). .SH "BENCHMARKS" .IX Header "BENCHMARKS" The options \f(CW\*(C`case_sensitive\*(C'\fR, \f(CW\*(C`loop_context_vars\*(C'\fR and \f(CW\*(C`global_vars\*(C'\fR can have the biggest influence on speed. .PP Setting case_sensitive to 1, loop_context_vars to 0 and global_vars to 0 saves time. .PP On the other hand, compared to HTML::Template, you have a large speed gain under mod_perl if you use case_sensitive = 1, loop_context_vars = 0, With \s-1CGI HTC\s0 is slower. .PP See the \f(CW\*(C`examples/bench.pl\*(C'\fR contained in this distribution. .PP Here are some examples from the benchmark script. I'm showing only Template::AutoFilter, Template::HTML, HTML::Template and \s-1HTC.\s0 These four modules allow you to set automatic \s-1HTML\s0 escaping ('filter') for all variables. .PP .Vb 4 \& loop_context_vars 1 \& global_vars 0 \& case_sensitive 1 \& default_escape HTML (respectively Template::AutoFilter and Template::HTML) \& \& ht: HTML::Template 2.10 \& htc: HTML::Template::Compiled 0.95 \& ttaf: Template::AutoFilter 0.112350 with Template 2.22 \& tth: Template::HTML 0.02 with Template 2.22 .Ve .PP First test is with the test.(htc|tt) from the examples directory, about 900 bytes. .PP Test without file cache and without memory cache. .PP .Vb 4 \& all_ht: 1 wallclock secs ( 0.40 usr + 0.00 sys = 0.40 CPU) @ 250.00/s (n=100) \& all_htc: 1 wallclock secs ( 1.74 usr + 0.01 sys = 1.75 CPU) @ 57.14/s (n=100) \& all_ttaf_new_object: 1 wallclock secs ( 1.69 usr + 0.01 sys = 1.70 CPU) @ 58.82/s (n=100) \& all_tth_new_object: 1 wallclock secs ( 1.44 usr + 0.00 sys = 1.44 CPU) @ 69.44/s (n=100) .Ve .PP With file cache: .PP .Vb 4 \& all_ht: 1 wallclock secs ( 1.03 usr + 0.01 sys = 1.04 CPU) @ 379.81/s (n=395) \& all_htc: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 260.75/s (n=279) \& all_ttaf_new_object: 1 wallclock secs ( 1.07 usr + 0.04 sys = 1.11 CPU) @ 251.35/s (n=279) \& all_tth_new_object: 1 wallclock secs ( 1.01 usr + 0.04 sys = 1.05 CPU) @ 227.62/s (n=239) .Ve .PP With memory cache: .PP .Vb 4 \& all_ht: 1 wallclock secs ( 1.04 usr + 0.00 sys = 1.04 CPU) @ 461.54/s (n=480) \& all_htc: 1 wallclock secs ( 1.05 usr + 0.01 sys = 1.06 CPU) @ 3168.87/s (n=3359) \& process_ttaf: 1 wallclock secs ( 1.04 usr + 0.00 sys = 1.04 CPU) @ 679.81/s (n=707) \& process_tth: 1 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 609.52/s (n=640) .Ve .PP Now I'm using a template with about 18Kb by multiplying the example template 20 times. You can see that everything is running slower but some run more slower than others. .PP Test without file cache and without memory cache. .PP .Vb 4 \& all_ht: 8 wallclock secs ( 7.57 usr + 0.04 sys = 7.61 CPU) @ 13.14/s (n=100) \& all_htc: 32 wallclock secs (32.08 usr + 0.06 sys = 32.14 CPU) @ 3.11/s (n=100) \& all_ttaf_new_object: 36 wallclock secs (36.21 usr + 0.04 sys = 36.25 CPU) @ 2.76/s (n=100) \& all_tth_new_object: 29 wallclock secs (28.92 usr + 0.05 sys = 28.97 CPU) @ 3.45/s (n=100) .Ve .PP With file cache: .PP .Vb 4 \& all_ht: 8 wallclock secs ( 7.22 usr + 0.00 sys = 7.22 CPU) @ 13.85/s (n=100) \& all_htc: 5 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU) @ 18.80/s (n=100) \& all_ttaf_new_object: 8 wallclock secs ( 7.59 usr + 0.15 sys = 7.74 CPU) @ 12.92/s (n=100) \& all_tth_new_object: 9 wallclock secs ( 8.74 usr + 0.19 sys = 8.93 CPU) @ 11.20/s (n=100) .Ve .PP With memory cache: .PP .Vb 4 \& all_ht: 1 wallclock secs ( 1.04 usr + 0.01 sys = 1.05 CPU) @ 15.24/s (n=16) \& all_htc: 1 wallclock secs ( 1.12 usr + 0.00 sys = 1.12 CPU) @ 272.32/s (n=305) \& process_ttaf: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 39.25/s (n=42) \& process_tth: 1 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 34.29/s (n=36) .Ve .PP So the performance difference highly depends on the size of the template and on the various options. You can see that using the 900byte template \s-1HTC\s0 is slower with file cache than HTML::Template, but with the 18Kb template it's faster. .SH "EXAMPLES" .IX Header "EXAMPLES" See \*(L"objects.html\*(R" in examples (and \f(CW\*(C`examples/objects.pl\*(C'\fR) for an example how to feed objects to \s-1HTC.\s0 .SH "BUGS" .IX Header "BUGS" Probably many bugs I don't know yet =) .PP Use the bugtracking system to report a bug: http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML\-Template\-Compiled .SH "Why another Template System?" .IX Header "Why another Template System?" You might ask why I implement yet another templating system. There are so many to choose from. Well, there are several reasons. .PP I like the syntax of HTML::Template *because* it is very restricted. It's also easy to use (template syntax and \s-1API\s0). However, there are some things I miss I try to implement here. .PP I think while HTML::Template is quite good, the implementation can be made more efficient (and still pure Perl). That's what I'm trying to achieve. .PP I use it in my web applications, so I first write it for myself =) If I can efficiently use it, it was worth it. .SH "RESOURCES" .IX Header "RESOURCES" See http://htcompiled.sf.net/ for svn access. .SH "SEE ALSO" .IX Header "SEE ALSO" HTML::Template .PP HTML::Template::JIT .PP Template \- Toolkit .PP http://www.tinita.de/projects/perl/ .SH "AUTHOR" .IX Header "AUTHOR" Tina Mueller .SH "CREDITS" .IX Header "CREDITS" Sam Tregar big thanks for ideas and letting me use his HTML::Template test suite .PP Bjoern Kriews for original idea and contributions .PP Special Thanks to Sascha Kiefer \- he finds all the bugs! .PP Ronnie Neumann, Martin Fabiani, Kai Sengpiel, Jan Willamowius, Justin Day, Steffen Winkler, Henrik Tougaard for ideas, beta-testing and patches .PP and http://www.perl\-community.de/> for everyday learning .PP Corion, Limbic~Region, tye, runrig and others from perlmonks.org .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2005\-2012 by Tina Mueller .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.