Server IP : 103.119.228.120 / Your IP : 18.191.27.78 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 "Template::Manual::Filters 3" .TH Template::Manual::Filters 3 "2014-04-24" "perl v5.16.3" "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" Template::Manual::Filters \- Standard filters .SH "format(format)" .IX Header "format(format)" The \f(CW\*(C`format\*(C'\fR filter takes a format string as a parameter (as per \&\f(CW\*(C`printf()\*(C'\fR) and formats each line of text accordingly. .PP .Vb 4 \& [% FILTER format(\*(Aq<!\-\- %\-40s \-\->\*(Aq) %] \& This is a block of text filtered \& through the above format. \& [% END %] .Ve .PP Output: .PP .Vb 2 \& <!\-\- This is a block of text filtered \-\-> \& <!\-\- through the above format. \-\-> .Ve .SH "upper" .IX Header "upper" Folds the input to \s-1UPPER CASE.\s0 .PP .Vb 1 \& [% "hello world" FILTER upper %] .Ve .PP Output: .PP .Vb 1 \& HELLO WORLD .Ve .SH "lower" .IX Header "lower" Folds the input to lower case. .PP .Vb 1 \& [% "Hello World" FILTER lower %] .Ve .PP Output: .PP .Vb 1 \& hello world .Ve .SH "ucfirst" .IX Header "ucfirst" Folds the first character of the input to \s-1UPPER CASE.\s0 .PP .Vb 1 \& [% "hello" FILTER ucfirst %] .Ve .PP Output: .PP .Vb 1 \& Hello .Ve .SH "lcfirst" .IX Header "lcfirst" Folds the first character of the input to lower case. .PP .Vb 1 \& [% "HELLO" FILTER lcfirst %] .Ve .PP Output: .PP .Vb 1 \& hELLO .Ve .SH "trim" .IX Header "trim" Trims any leading or trailing whitespace from the input text. Particularly useful in conjunction with \f(CW\*(C`INCLUDE\*(C'\fR, \f(CW\*(C`PROCESS\*(C'\fR, etc., having the same effect as the \f(CW\*(C`TRIM\*(C'\fR configuration option. .PP .Vb 1 \& [% INCLUDE myfile | trim %] .Ve .SH "collapse" .IX Header "collapse" Collapse any whitespace sequences in the input text into a single space. Leading and trailing whitespace (which would be reduced to a single space) is removed, as per trim. .PP .Vb 1 \& [% FILTER collapse %] \& \& The cat \& \& sat on \& \& the mat \& \& [% END %] .Ve .PP Output: .PP .Vb 1 \& The cat sat on the mat .Ve .SH "html" .IX Header "html" Converts the characters \f(CW\*(C`<\*(C'\fR, \f(CW\*(C`>\*(C'\fR, \f(CW\*(C`&\*(C'\fR and \f(CW\*(C`"\*(C'\fR to \f(CW\*(C`<\*(C'\fR, \&\f(CW\*(C`>\*(C'\fR, \f(CW\*(C`&\*(C'\fR, and \f(CW\*(C`"\*(C'\fR respectively, protecting them from being interpreted as representing \s-1HTML\s0 tags or entities. .PP .Vb 3 \& [% FILTER html %] \& Binary "<=>" returns \-1, 0, or 1 depending on... \& [% END %] .Ve .PP Output: .PP .Vb 1 \& Binary "<=>" returns \-1, 0, or 1 depending on... .Ve .SH "html_entity" .IX Header "html_entity" The \f(CW\*(C`html\*(C'\fR filter is fast and simple but it doesn't encode the full range of \s-1HTML\s0 entities that your text may contain. The \f(CW\*(C`html_entity\*(C'\fR filter uses either the \f(CW\*(C`Apache::Util\*(C'\fR module (which is written in C and is therefore faster) or the \f(CW\*(C`HTML::Entities\*(C'\fR module (written in Perl but equally as comprehensive) to perform the encoding. .PP If one or other of these modules are installed on your system then the text will be encoded (via the \f(CW\*(C`escape_html()\*(C'\fR or \f(CW\*(C`encode_entities()\*(C'\fR subroutines respectively) to convert all extended characters into their appropriate \s-1HTML\s0 entities (e.g. converting '\f(CW\*(C`?\*(C'\fR' to '\f(CW\*(C`é\*(C'\fR'). If neither module is available on your system then an '\f(CW\*(C`html_entity\*(C'\fR' exception will be thrown reporting an appropriate message. .PP If you want to force \s-1TT\s0 to use one of the above modules in preference to the other, then call either of the Template::Filters class methods: \&\fIuse_html_entities()\fR or \&\fIuse_apache_util()\fR. .PP .Vb 2 \& use Template::Filters; \& Template::Filters\->use_html_entities; .Ve .PP For further information on \s-1HTML\s0 entity encoding, see <http://www.w3.org/TR/REC\-html40/sgml/entities.html>. .SH "xml" .IX Header "xml" Same as the \f(CW\*(C`html\*(C'\fR filter, but adds \f(CW\*(C`'\*(C'\fR which is the fifth \s-1XML\s0 built-in entity. .SH "html_para" .IX Header "html_para" This filter formats a block of text into \s-1HTML\s0 paragraphs. A sequence of two or more newlines is used as the delimiter for paragraphs which are then wrapped in \s-1HTML \s0\f(CW\*(C`<p>\*(C'\fR...\f(CW\*(C`</p>\*(C'\fR tags. .PP .Vb 2 \& [% FILTER html_para %] \& The cat sat on the mat. \& \& Mary had a little lamb. \& [% END %] .Ve .PP Output: .PP .Vb 3 \& <p> \& The cat sat on the mat. \& </p> \& \& <p> \& Mary had a little lamb. \& </p> .Ve .SH "html_break / html_para_break" .IX Header "html_break / html_para_break" Similar to the html_para filter described above, but uses the \s-1HTML\s0 tag sequence \f(CW\*(C`<br><br>\*(C'\fR to join paragraphs. .PP .Vb 2 \& [% FILTER html_break %] \& The cat sat on the mat. \& \& Mary had a little lamb. \& [% END %] .Ve .PP Output: .PP .Vb 4 \& The cat sat on the mat. \& <br> \& <br> \& Mary had a little lamb. .Ve .SH "html_line_break" .IX Header "html_line_break" This filter replaces any newlines with \f(CW\*(C`<br>\*(C'\fR \s-1HTML\s0 tags, thus preserving the line breaks of the original text in the \&\s-1HTML\s0 output. .PP .Vb 4 \& [% FILTER html_line_break %] \& The cat sat on the mat. \& Mary had a little lamb. \& [% END %] .Ve .PP Output: .PP .Vb 2 \& The cat sat on the mat.<br> \& Mary had a little lamb.<br> .Ve .SH "uri" .IX Header "uri" This filter \s-1URI\s0 escapes the input text, converting any characters outside of the permitted \s-1URI\s0 character set (as defined by \s-1RFC 3986\s0) into a \f(CW%nn\fR hex escape. .PP .Vb 1 \& [% \*(Aqmy file.html\*(Aq | uri %] .Ve .PP Output: .PP .Vb 1 \& my%20file.html .Ve .PP The uri filter correctly encodes all reserved characters, including \&\f(CW\*(C`&\*(C'\fR, \f(CW\*(C`@\*(C'\fR, \f(CW\*(C`/\*(C'\fR, \f(CW\*(C`;\*(C'\fR, \f(CW\*(C`:\*(C'\fR, \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+\*(C'\fR, \f(CW\*(C`?\*(C'\fR and \f(CW\*(C`$\*(C'\fR. This filter is typically used to encode parameters in a \s-1URL\s0 that could otherwise be interpreted as part of the \s-1URL. \s0 Here's an example: .PP .Vb 5 \& [% path = \*(Aqhttp://tt2.org/example\*(Aq \& back = \*(Aq/other?foo=bar&baz=bam\*(Aq \& title = \*(AqEarth: "Mostly Harmless"\*(Aq \& %] \& <a href="[% path %]?back=[% back | uri %]&title=[% title | uri %]"> .Ve .PP The output generated is rather long so we'll show it split across two lines: .PP .Vb 2 \& <a href="http://tt2.org/example?back=%2Fother%3Ffoo%3Dbar%26 \& baz%3Dbam&title=Earth%3A%20%22Mostly%20Harmless%22"> .Ve .PP Without the uri filter the output would look like this (also split across two lines). .PP .Vb 2 \& <a href="http://tt2.org/example?back=/other?foo=bar \& &baz=bam&title=Earth: "Mostly Harmless""> .Ve .PP In this rather contrived example we've manage to generate both a broken \s-1URL \&\s0(the repeated \f(CW\*(C`?\*(C'\fR is not allowed) and a broken \s-1HTML\s0 element (the href attribute is terminated by the first \f(CW\*(C`"\*(C'\fR after \f(CW\*(C`Earth: \*(C'\fR leaving \f(CW\*(C`Mostly Harmless"\*(C'\fR dangling on the end of the tag in precisely the way that harmless things shouldn't dangle). So don't do that. Always use the uri filter to encode your \s-1URL\s0 parameters. .PP However, you should \fBnot\fR use the uri filter to encode an entire \s-1URL.\s0 .PP .Vb 1 \& <a href="[% page_url | uri %]"> # WRONG! .Ve .PP This will incorrectly encode any reserved characters like \f(CW\*(C`:\*(C'\fR and \f(CW\*(C`/\*(C'\fR and that's almost certainly not what you want in this case. Instead you should use the \fBurl\fR (note spelling) filter for this purpose. .PP .Vb 1 \& <a href="[% page_url | url %]"> # CORRECT .Ve .PP Please note that this behaviour was changed in version 2.16 of the Template Toolkit. Prior to that, the uri filter did not encode the reserved characters, making it technically incorrect according to the \&\s-1RFC 2396\s0 specification (since superceded by \s-1RFC2732\s0 and \s-1RFC3986\s0). So we fixed it in 2.16 and provided the url filter to implement the old behaviour of not encoding reserved characters. .PP As of version 2.26 of the Template Toolkit, the \f(CW\*(C`uri\*(C'\fR and url filters use the unsafe character set defined by \s-1RFC3986. \s0 This means that certain characters (\*(L"(\*(R", \*(L")\*(R", \*(L"~\*(R", \*(L"*\*(R", \*(L"!\*(R" and the single quote \*(L"'\*(R") are now deemed unsafe and will be escaped as hex character sequences. The double quote character ('"') is now deemed safe and will not be escaped. .PP If you want to enable the old behaviour then call the \f(CW\*(C`use_rfc2732()\*(C'\fR method in Template::Filters .PP .Vb 2 \& use Template::Filters \& Template::Filters\->use_rfc2732; .Ve .SH "url" .IX Header "url" The url filter is a less aggressive version of the uri filter. It encodes any characters outside of the permitted \s-1URI\s0 character set (as defined by \s-1RFC 2396\s0) into \f(CW%nn\fR hex escapes. However, unlike the uri filter, the url filter does \&\fBnot\fR encode the reserved characters \f(CW\*(C`&\*(C'\fR, \f(CW\*(C`@\*(C'\fR, \f(CW\*(C`/\*(C'\fR, \f(CW\*(C`;\*(C'\fR, \f(CW\*(C`:\*(C'\fR, \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+\*(C'\fR, \&\f(CW\*(C`?\*(C'\fR and \f(CW\*(C`$\*(C'\fR. .SH "indent(pad)" .IX Header "indent(pad)" Indents the text block by a fixed pad string or width. The '\f(CW\*(C`pad\*(C'\fR' argument can be specified as a string, or as a numerical value to indicate a pad width (spaces). Defaults to 4 spaces if unspecified. .PP .Vb 4 \& [% FILTER indent(\*(AqME> \*(Aq) %] \& blah blah blah \& cabbages, rhubard, onions \& [% END %] .Ve .PP Output: .PP .Vb 2 \& ME> blah blah blah \& ME> cabbages, rhubard, onions .Ve .SH "truncate(length,dots)" .IX Header "truncate(length,dots)" Truncates the text block to the length specified, or a default length of 32. Truncated text will be terminated with '\f(CW\*(C`...\*(C'\fR' (i.e. the '\f(CW\*(C`...\*(C'\fR' falls inside the required length, rather than appending to it). .PP .Vb 4 \& [% FILTER truncate(21) %] \& I have much to say on this matter that has previously \& been said on more than one occasion. \& [% END %] .Ve .PP Output: .PP .Vb 1 \& I have much to say... .Ve .PP If you want to use something other than '\f(CW\*(C`...\*(C'\fR' you can pass that as a second argument. .PP .Vb 4 \& [% FILTER truncate(26, \*(Aq…\*(Aq) %] \& I have much to say on this matter that has previously \& been said on more than one occasion. \& [% END %] .Ve .PP Output: .PP .Vb 1 \& I have much to say… .Ve .SH "repeat(iterations)" .IX Header "repeat(iterations)" Repeats the text block for as many iterations as are specified (default: 1). .PP .Vb 4 \& [% FILTER repeat(3) %] \& We want more beer and we want more beer, \& [% END %] \& We are the more beer wanters! .Ve .PP Output: .PP .Vb 4 \& We want more beer and we want more beer, \& We want more beer and we want more beer, \& We want more beer and we want more beer, \& We are the more beer wanters! .Ve .SH "remove(string)" .IX Header "remove(string)" Searches the input text for any occurrences of the specified string and removes them. A Perl regular expression may be specified as the search string. .PP .Vb 1 \& [% "The cat sat on the mat" FILTER remove(\*(Aq\es+\*(Aq) %] .Ve .PP Output: .PP .Vb 1 \& Thecatsatonthemat .Ve .SH "replace(search, replace)" .IX Header "replace(search, replace)" Similar to the remove filter described above, but taking a second parameter which is used as a replacement string for instances of the search string. .PP .Vb 1 \& [% "The cat sat on the mat" | replace(\*(Aq\es+\*(Aq, \*(Aq_\*(Aq) %] .Ve .PP Output: .PP .Vb 1 \& The_cat_sat_on_the_mat .Ve .SH "redirect(file, options)" .IX Header "redirect(file, options)" The \f(CW\*(C`redirect\*(C'\fR filter redirects the output of the block into a separate file, specified relative to the \f(CW\*(C`OUTPUT_PATH\*(C'\fR configuration item. .PP .Vb 5 \& [% FOREACH user IN myorg.userlist %] \& [% FILTER redirect("users/${user.id}.html") %] \& [% INCLUDE userinfo %] \& [% END %] \& [% END %] .Ve .PP or more succinctly, using side-effect notation: .PP .Vb 5 \& [% FOREACH user IN myorg.userlist; \& INCLUDE userinfo \& FILTER redirect("users/${user.id}.html"); \& END \& %] .Ve .PP A \f(CW\*(C`file\*(C'\fR exception will be thrown if the \f(CW\*(C`OUTPUT_PATH\*(C'\fR option is undefined. .PP An optional \f(CW\*(C`binmode\*(C'\fR argument can follow the filename to explicitly set the output file to binary mode. .PP .Vb 2 \& [% PROCESS my/png/generator \& FILTER redirect("images/logo.png", binmode=1) %] .Ve .PP For backwards compatibility with earlier versions, a single true/false value can be used to set binary mode. .PP .Vb 2 \& [% PROCESS my/png/generator \& FILTER redirect("images/logo.png", 1) %] .Ve .PP For the sake of future compatibility and clarity, if nothing else, we would strongly recommend you explicitly use the named \f(CW\*(C`binmode\*(C'\fR option as shown in the first example. .SH "eval / evaltt" .IX Header "eval / evaltt" The \f(CW\*(C`eval\*(C'\fR filter evaluates the block as template text, processing any directives embedded within it. This allows template variables to contain template fragments, or for some method to be provided for returning template fragments from an external source such as a database, which can then be processed in the template as required. .PP .Vb 4 \& my $vars = { \& fragment => "The cat sat on the [% place %]", \& }; \& $template\->process($file, $vars); .Ve .PP The following example: .PP .Vb 1 \& [% fragment | eval %] .Ve .PP is therefore equivalent to .PP .Vb 1 \& The cat sat on the [% place %] .Ve .PP The \f(CW\*(C`evaltt\*(C'\fR filter is provided as an alias for \f(CW\*(C`eval\*(C'\fR. .SH "perl / evalperl" .IX Header "perl / evalperl" The \f(CW\*(C`perl\*(C'\fR filter evaluates the block as Perl code. The \f(CW\*(C`EVAL_PERL\*(C'\fR option must be set to a true value or a \f(CW\*(C`perl\*(C'\fR exception will be thrown. .PP .Vb 1 \& [% my_perl_code | perl %] .Ve .PP In most cases, the \f(CW\*(C`[% PERL %]\*(C'\fR ... \f(CW\*(C`[% END %]\*(C'\fR block should suffice for evaluating Perl code, given that template directives are processed before being evaluate as Perl. Thus, the previous example could have been written in the more verbose form: .PP .Vb 3 \& [% PERL %] \& [% my_perl_code %] \& [% END %] .Ve .PP as well as .PP .Vb 3 \& [% FILTER perl %] \& [% my_perl_code %] \& [% END %] .Ve .PP The \f(CW\*(C`evalperl\*(C'\fR filter is provided as an alias for \f(CW\*(C`perl\*(C'\fR for backwards compatibility. .SH "stdout(options)" .IX Header "stdout(options)" The stdout filter prints the output generated by the enclosing block to \&\f(CW\*(C`STDOUT\*(C'\fR. The \f(CW\*(C`binmode\*(C'\fR option can be passed as either a named parameter or a single argument to set \f(CW\*(C`STDOUT\*(C'\fR to binary mode (see the binmode perl function). .PP .Vb 2 \& [% PROCESS something/cool \& FILTER stdout(binmode=1) # recommended %] \& \& [% PROCESS something/cool \& FILTER stdout(1) # alternate %] .Ve .PP The \f(CW\*(C`stdout\*(C'\fR filter can be used to force \f(CW\*(C`binmode\*(C'\fR on \f(CW\*(C`STDOUT\*(C'\fR, or also inside \f(CW\*(C`redirect\*(C'\fR, \f(CW\*(C`null\*(C'\fR or \f(CW\*(C`stderr\*(C'\fR blocks to make sure that particular output goes to \f(CW\*(C`STDOUT\*(C'\fR. See the \f(CW\*(C`null\*(C'\fR filter below for an example. .SH "stderr" .IX Header "stderr" The stderr filter prints the output generated by the enclosing block to \&\f(CW\*(C`STDERR\*(C'\fR. .SH "null" .IX Header "null" The \f(CW\*(C`null\*(C'\fR filter prints nothing. This is useful for plugins whose methods return values that you don't want to appear in the output. Rather than assigning every plugin method call to a dummy variable to silence it, you can wrap the block in a null filter: .PP .Vb 10 \& [% FILTER null; \& USE im = GD.Image(100,100); \& black = im.colorAllocate(0, 0, 0); \& red = im.colorAllocate(255,0, 0); \& blue = im.colorAllocate(0, 0, 255); \& im.arc(50,50,95,75,0,360,blue); \& im.fill(50,50,red); \& im.png | stdout(1); \& END; \& \-%] .Ve .PP Notice the use of the \f(CW\*(C`stdout\*(C'\fR filter to ensure that a particular expression generates output to \f(CW\*(C`STDOUT\*(C'\fR (in this case in binary mode).