Server IP : 103.119.228.120 / Your IP : 3.143.218.180 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/ssl/local/ssl/local/ssl/local/ssl/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::Plugin::Table 3" .TH Template::Plugin::Table 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::Plugin::Table \- Plugin to present data in a table .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& [% USE table(list, rows=n, cols=n, overlap=n, pad=0) %] \& \& [% FOREACH item IN table.row(n) %] \& [% item %] \& [% END %] \& \& [% FOREACH item IN table.col(n) %] \& [% item %] \& [% END %] \& \& [% FOREACH row IN table.rows %] \& [% FOREACH item IN row %] \& [% item %] \& [% END %] \& [% END %] \& \& [% FOREACH col IN table.cols %] \& [% col.first %] \- [% col.last %] ([% col.size %] entries) \& [% END %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`Table\*(C'\fR plugin allows you to format a list of data items into a virtual table. When you create a \f(CW\*(C`Table\*(C'\fR plugin via the \f(CW\*(C`USE\*(C'\fR directive, simply pass a list reference as the first parameter and then specify a fixed number of rows or columns. .PP .Vb 2 \& [% USE Table(list, rows=5) %] \& [% USE table(list, cols=5) %] .Ve .PP The \f(CW\*(C`Table\*(C'\fR plugin name can also be specified in lower case as shown in the second example above. You can also specify an alternative variable name for the plugin as per regular Template Toolkit syntax. .PP .Vb 1 \& [% USE mydata = table(list, rows=5) %] .Ve .PP The plugin then presents a table based view on the data set. The data isn't actually reorganised in any way but is available via the \f(CW\*(C`row()\*(C'\fR, \&\f(CW\*(C`col()\*(C'\fR, \f(CW\*(C`rows()\*(C'\fR and \f(CW\*(C`cols()\*(C'\fR as if formatted into a simple two dimensional table of \f(CW\*(C`n\*(C'\fR rows x \f(CW\*(C`n\*(C'\fR columns. .PP So if we had a sample \f(CW\*(C`alphabet\*(C'\fR list contained the letters '\f(CW\*(C`a\*(C'\fR' to '\f(CW\*(C`z\*(C'\fR', the above \f(CW\*(C`USE\*(C'\fR directives would create plugins that represented the following views of the alphabet. .PP .Vb 1 \& [% USE table(alphabet, ... %] \& \& rows=5 cols=5 \& a f k p u z a g m s y \& b g l q v b h n t z \& c h m r w c i o u \& d i n s x d j p v \& e j o t y e k q w \& f l r x .Ve .PP We can request a particular row or column using the \f(CW\*(C`row()\*(C'\fR and \f(CW\*(C`col()\*(C'\fR methods. .PP .Vb 4 \& [% USE table(alphabet, rows=5) %] \& [% FOREACH item = table.row(0) %] \& # [% item %] set to each of [ a f k p u z ] in turn \& [% END %] \& \& [% FOREACH item = table.col(2) %] \& # [% item %] set to each of [ m n o p q r ] in turn \& [% END %] .Ve .PP Data in rows is returned from left to right, columns from top to bottom. The first row/column is 0. By default, rows or columns that contain empty values will be padded with the undefined value to fill it to the same size as all other rows or columns. .PP For example, the last row (row 4) in the first example would contain the values \f(CW\*(C`[ e j o t y undef ]\*(C'\fR. The Template Toolkit will safely accept these undefined values and print a empty string. You can also use the \s-1IF\s0 directive to test if the value is set. .PP .Vb 5 \& [% FOREACH item = table.row(4) %] \& [% IF item %] \& Item: [% item %] \& [% END %] \& [% END %] .Ve .PP You can explicitly disable the \f(CW\*(C`pad\*(C'\fR option when creating the plugin to returned shortened rows/columns where the data is empty. .PP .Vb 4 \& [% USE table(alphabet, cols=5, pad=0) %] \& [% FOREACH item = table.col(4) %] \& # [% item %] set to each of \*(Aqy z\*(Aq \& [% END %] .Ve .PP The \f(CW\*(C`rows()\*(C'\fR method returns all rows/columns in the table as a reference to a list of rows (themselves list references). The \f(CW\*(C`row()\*(C'\fR methods when called without any arguments calls \f(CW\*(C`rows()\*(C'\fR to return all rows in the table. .PP Ditto for \f(CW\*(C`cols()\*(C'\fR and \f(CW\*(C`col()\*(C'\fR. .PP .Vb 6 \& [% USE table(alphabet, cols=5) %] \& [% FOREACH row = table.rows %] \& [% FOREACH item = row %] \& [% item %] \& [% END %] \& [% END %] .Ve .PP The Template Toolkit provides the \f(CW\*(C`first\*(C'\fR, \f(CW\*(C`last\*(C'\fR and \f(CW\*(C`size\*(C'\fR virtual methods that can be called on list references to return the first/last entry or the number of entries in a list. The following example shows how we might use this to provide an alphabetical index split into 3 even parts. .PP .Vb 4 \& [% USE table(alphabet, cols=3, pad=0) %] \& [% FOREACH group = table.col %] \& [ [% group.first %] \- [% group.last %] ([% group.size %] letters) ] \& [% END %] .Ve .PP This produces the following output: .PP .Vb 3 \& [ a \- i (9 letters) ] \& [ j \- r (9 letters) ] \& [ s \- z (8 letters) ] .Ve .PP We can also use the general purpose \f(CW\*(C`join\*(C'\fR virtual method which joins the items of the list using the connecting string specified. .PP .Vb 4 \& [% USE table(alphabet, cols=5) %] \& [% FOREACH row = table.rows %] \& [% row.join(\*(Aq \- \*(Aq) %] \& [% END %] .Ve .PP Data in the table is ordered downwards rather than across but can easily be transformed on output. For example, to format our data in 5 columns with data ordered across rather than down, we specify \f(CW\*(C`rows=5\*(C'\fR to order the data as such: .PP .Vb 5 \& a f . . \& b g . \& c h \& d i \& e j .Ve .PP and then iterate down through each column (a\-e, f\-j, etc.) printing the data across. .PP .Vb 4 \& a b c d e \& f g h i j \& . . \& . .Ve .PP Example code to do so would be much like the following: .PP .Vb 6 \& [% USE table(alphabet, rows=3) %] \& [% FOREACH cols = table.cols %] \& [% FOREACH item = cols %] \& [% item %] \& [% END %] \& [% END %] .Ve .PP Output: .PP .Vb 5 \& a b c \& d e f \& g h i \& j . . \& . .Ve .PP In addition to a list reference, the \f(CW\*(C`Table\*(C'\fR plugin constructor may be passed a reference to a Template::Iterator object or subclass thereof. The Template::Iterator \fIget_all()\fR method is first called on the iterator to return all remaining items. These are then available via the usual Table interface. .PP .Vb 1 \& [% USE DBI(dsn,user,pass) \-%] \& \& # query() returns an iterator \& [% results = DBI.query(\*(AqSELECT * FROM alphabet ORDER BY letter\*(Aq) %] \& \& # pass into Table plugin \& [% USE table(results, rows=8 overlap=1 pad=0) \-%] \& \& [% FOREACH row = table.cols \-%] \& [% row.first.letter %] \- [% row.last.letter %]: \& [% row.join(\*(Aq, \*(Aq) %] \& [% END %] .Ve .SH "AUTHOR" .IX Header "AUTHOR" Andy Wardley <abw@wardley.org> <http://wardley.org/> .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 1996\-2007 Andy Wardley. All Rights Reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Template::Plugin