File: Plugins.html

package info (click to toggle)
libtemplate-perl 2.24-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,660 kB
  • sloc: perl: 14,518; makefile: 15; sh: 5
file content (560 lines) | stat: -rwxr-xr-x 33,410 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<html>
  <head>
    <title>Template::Manual::Plugins</title>
    <link rel="stylesheet" type="text/css" href="../css/blue.css" title="Clear Blue">
    <link rel="alternate stylesheet" type="text/css" href="../css/orange.css" title="Clear Orange">
    <link rel="alternate stylesheet" type="text/css" href="../css/green.css" title="Clear Green">
    <link rel="alternate stylesheet" type="text/css" href="../css/purple.css" title="Clear Purple">
    <link rel="alternate stylesheet" type="text/css" href="../css/grey.css" title="Clear Grey">
    <link rel="alternate stylesheet" type="text/css" href="../css/print.css" title="Print">
    <!--[if IE 6]>
    <link rel="stylesheet" type="text/css" href="../css/ie6.css" />
    <![endif]-->
    <!--[if IE 7]>
    <link rel="stylesheet" type="text/css" href="../css/ie7.css" />
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../css/print.css" media="print">
    <script type="text/javascript" src="../js/tt2.js"></script>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta name="author" content="Andy Wardley">
  </head>
  <body id="body"> 
    <div id="layout">
        <div id="header">
          <a href="../index.html" id="logo" alt="" title="Click for the Home Page"><span class="alt">TT2 Home Page</span></a>
          <ul id="trail">
            <li><a href="../manual/index.html">Manual</a></li>
            <li class="last"><a href="../manual/Plugins.html">Plugins</a></li>
          </ul>
          <div class="controls">
            <a href="#" class="menu show" onclick="widescreen_off(); return false" title="Show Menu">
              <span class="about">Click to view the menu.  It's very nice.</span>
            </a>
            <a href="#" class="menu hide" onclick="widescreen_on();  return false" title="Hide Menu">
              <span class="about">Click to hide the menu and go all widescreen!</span>
            </a>
          
          <div class="pager">
            <a href="../manual/Filters.html" title="Template::Manual::Filters" class="go back">Back<span class="about"><h4>Template::Manual::Filters</h4>Standard filters</span></a>
            <a href="../manual/index.html" title="Template::Manual" class="go up">Up<span class="about"><h4>Template::Manual</h4>Template Toolkit User Manual</span></a>
            <a href="../manual/Internals.html" title="Template::Manual::Internals" class="go next">Next<span class="about"><h4>Template::Manual::Internals</h4>Template Toolkit internals</span></a>
          </div>
          </div>
          <h1 class="headline">Template::Manual::Plugins</h1>
          <h2 class="subhead">Standard plugins</h1>
        
        </div>
        
        <div id="page">
          <div id="sidebar">
            <a href="../index.html" id="logo"></a>
            <div id="menu">
              <ul class="menu">
                <li class="l0 first"><a href="../manual/index.html" class="warm">Manual</a></li>
                <li class="l1"><a href="../manual/Intro.html">Intro</a></li>
                <li class="l1"><a href="../manual/Syntax.html">Syntax</a></li>
                <li class="l1"><a href="../manual/Directives.html">Directives</a></li>
                <li class="l1"><a href="../manual/Variables.html">Variables</a></li>
                <li class="l1"><a href="../manual/VMethods.html">VMethods</a></li>
                <li class="l1"><a href="../manual/Config.html">Config</a></li>
                <li class="l1"><a href="../manual/Filters.html">Filters</a></li>
                <li class="l1"><a href="../manual/Plugins.html" class="warm">Plugins</a></li>
                <li class="l1"><a href="../manual/Internals.html">Internals</a></li>
                <li class="l1"><a href="../manual/Views.html">Views</a></li>
                <li class="l1"><a href="../manual/Credits.html">Credits</a></li>
                <li class="l0"><a href="../modules/index.html">Modules</a></li>
                <li class="l0"><a href="../tools/index.html">Tools</a></li>
                <li class="l0"><a href="../tutorial/index.html">Tutorial</a></li>
                <li class="l0 last"><a href="../faq/index.html">FAQ</a></li>
              </ul>
              <div class="foot"></div>
            </div>
          </div>
          <div id="content">
          <div class="section">
            <div class="head">
              <h1 id="contents" onclick="switch_section(this)" title="Click title to show/hide section content.">Contents</h1>
              <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
            </div>
            <div class="body">
              <ul class="toc">
                  <li class=""><a href="#TEMPLATE_TOOLKIT_PLUGINS">TEMPLATE TOOLKIT PLUGINS</a></li>
                  <li class="sub"><a href="#section_Assert">Assert</a></li>
                  <li class="sub"><a href="#section_CGI">CGI</a></li>
                  <li class="sub"><a href="#section_Datafile">Datafile</a></li>
                  <li class="sub"><a href="#section_Date">Date</a></li>
                  <li class="sub"><a href="#section_Directory">Directory</a></li>
                  <li class="sub"><a href="#section_DBI">DBI</a></li>
                  <li class="sub"><a href="#section_Dumper">Dumper</a></li>
                  <li class="sub"><a href="#section_File">File</a></li>
                  <li class="sub"><a href="#section_Filter">Filter</a></li>
                  <li class="sub"><a href="#section_Format">Format</a></li>
                  <li class="sub"><a href="#section_GD">GD</a></li>
                  <li class="sub"><a href="#section_HTML">HTML</a></li>
                  <li class="sub"><a href="#section_Iterator">Iterator</a></li>
                  <li class="sub"><a href="#section_Pod">Pod</a></li>
                  <li class="sub"><a href="#section_Scalar">Scalar</a></li>
                  <li class="sub"><a href="#section_String">String</a></li>
                  <li class="sub"><a href="#section_Table">Table</a></li>
                  <li class="sub"><a href="#section_URL">URL</a></li>
                  <li class="sub"><a href="#section_Wrap">Wrap</a></li>
                  <li class="sub"><a href="#section_XML">XML</a></li>
              
              </ul>
            </div>
          </div>
          
                <div class="pod">
            <div class="section">
              <div class="head">
                <h1 id="TEMPLATE_TOOLKIT_PLUGINS" onclick="switch_section(this)" title="Click title to show/hide section content.">TEMPLATE TOOLKIT PLUGINS</h1>
                <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
              </div>
              <div class="body">
                <p>
                      The following plugin modules are distributed with the Template Toolkit.
                      Some of the plugins interface to external modules (detailed below) which
                      should be downloaded from any CPAN site and installed before using the
                      plugin.
                    </p>
                    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Assert" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Assert</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          New in 2.20! The <a href="../modules/Template/Plugin/Assert.html">Assert</a> plugin adds an <code>assert</code> virtual method that
                          you can use to catch undefined values.
                        </p>
                        <p>
                          For example, consider this dotop:
                        </p>
                        <pre><span class="tt">[% user.name %]</span></pre>
                        <p>
                          If <code>user.name</code> is an undefined value then TT will silently
                          ignore the fact and print nothing. If you <code>USE</code> the
                          <code>assert</code> plugin then you can add the <code>assert</code>
                          vmethod between the <code>user</code> and <code>name</code> elements,
                          like so:
                        </p>
                        <pre><span class="tt">[% user.assert.name %]</span></pre>
                        <p>
                          Now, if <code>user.name</code> is an undefined value, an exception will
                          be thrown:
                        </p>
                        <pre>assert error - undefined value for name</pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_CGI" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">CGI</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/CGI.html">CGI</a> plugin
                          is a wrapper around Lincoln Stein's CGI.pm module. The plugin is
                          distributed with the Template Toolkit (see <a href="../modules/Template/Plugin/CGI.html">Template::Plugin::CGI</a>) and
                          the <a href="http://search.cpan.org/search?query=CGI&mode=all">CGI</a> module itself is distributed
                          with recent versions Perl, or is available from CPAN.
                        </p>
                        <pre><span class="tt">[% USE CGI %]</span>
<span class="tt">[% CGI.param('param_name') %]</span>
<span class="tt">[% CGI.start_form %]</span>
<span class="tt">[% CGI.popup_menu( Name   =&gt; 'color', 
                   Values =&gt; [ 'Green', 'Brown' ] ) %]</span>
<span class="tt">[% CGI.end_form %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Datafile" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Datafile</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          Provides an interface to data stored in a plain text file in a simple
                          delimited format. The first line in the file specifies field names which
                          should be delimiter by any non-word character sequence. Subsequent lines
                          define data using the same delimiter as in the first line. Blank lines
                          and comments (lines starting '#') are ignored. See <a href="../modules/Template/Plugin/Datafile.html">Template::Plugin::Datafile</a> for further details.
                        </p>
                        <p>
                          /tmp/mydata:
                        </p>
                        <pre># define names for each field
id : email : name : tel
# here's the data
fred : fred@here.com : Fred Smith : 555-1234
bill : bill@here.com : Bill White : 555-5678</pre>
                        <p>
                          example:
                        </p>
                        <pre><span class="tt">[% USE userlist = datafile('/tmp/mydata') %]</span>

<span class="tt">[% FOREACH user = userlist %]</span>
   <span class="tt">[% user.name %]</span> (<span class="tt">[% user.id %]</span>)
<span class="tt">[% END %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Date" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Date</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Date.html">Date</a> plugin
                          provides an easy way to generate formatted time and date strings by
                          delegating to the <a href="http://search.cpan.org/search?query=POSIX&mode=all">POSIX</a>
                          <code>strftime()</code> routine. See <a href="../modules/Template/Plugin/Date.html">Template::Plugin::Date</a> and
                          <a href="http://search.cpan.org/search?query=POSIX&mode=all">POSIX</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE date %]</span>
<span class="tt">[% date.format %]</span>        # current time/date

File last modified: <span class="tt">[% date.format(template.modtime) %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Directory" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Directory</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Directory.html">Directory</a> plugin provides a simple interface to a directory and
                          the files within it. See <a href="../modules/Template/Plugin/Directory.html">Template::Plugin::Directory</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE dir = Directory('/tmp') %]</span>
<span class="tt">[% FOREACH file = dir.files %]</span>
    # all the plain files in the directory
<span class="tt">[% END %]</span>
<span class="tt">[% FOREACH file = dir.dirs %]</span>
    # all the sub-directories
<span class="tt">[% END %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_DBI" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">DBI</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <code>DBI</code> plugin is no longer distributed as part of the
                          Template Toolkit (as of version 2.15). It is now available as a separate
                          <a href="http://search.cpan.org/search?query=Template::DBI&mode=all">Template::DBI</a>
                          distribution from CPAN.
                        </p>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Dumper" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Dumper</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Dumper.html">Dumper</a>
                          plugin provides an interface to the Data::Dumper module. See <a href="../modules/Template/Plugin/Dumper.html">Template::Plugin::Dumper</a>
                          and <a href="http://search.cpan.org/search?query=Data::Dumper&mode=all">Data::Dumper</a> for futher
                          details.
                        </p>
                        <pre><span class="tt">[% USE dumper(indent=0, pad="&lt;br&gt;") %]</span>
<span class="tt">[% dumper.dump(myvar, yourvar) %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_File" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">File</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/File.html">File</a> plugin
                          provides a general abstraction for files and can be used to fetch
                          information about specific files within a filesystem. See <a href="../modules/Template/Plugin/File.html">Template::Plugin::File</a> for
                          further details.
                        </p>
                        <pre><span class="tt">[% USE File('/tmp/foo.html') %]</span>
<span class="tt">[% File.name %]</span>     # foo.html
<span class="tt">[% File.dir %]</span>      # /tmp
<span class="tt">[% File.mtime %]</span>    # modification time</pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Filter" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Filter</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          This module implements a base class plugin which can be subclassed to
                          easily create your own modules that define and install new filters.
                        </p>
                        <pre>package MyOrg::Template::Plugin::MyFilter;

use Template::Plugin::Filter;
use base qw( Template::Plugin::Filter );

sub filter {
    my ($self, $text) = @_;
    # ...mungify $text...
    return $text;
}</pre>
                        <p>
                          Example of use:
                        </p>
                        <pre># now load it...
<span class="tt">[% USE MyFilter %]</span>

# ...and use the returned object as a filter
<span class="tt">[% FILTER $MyFilter %]</span>
  ...
<span class="tt">[% END %]</span></pre>
                        <p>
                          See <a href="../modules/Template/Plugin/Filter.html">Template::Plugin::Filter</a> for further details.
                        </p>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Format" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Format</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Format.html">Format</a>
                          plugin provides a simple way to format text according to a
                          <code>printf()</code>-like format. See <a href="../modules/Template/Plugin/Format.html">Template::Plugin::Format</a>
                          for further details.
                        </p>
                        <pre><span class="tt">[% USE bold = format('&lt;b&gt;%s&lt;/b&gt;') %]</span>
<span class="tt">[% bold('Hello') %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_GD" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">GD</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <code>GD</code> plugins are no longer part of the core Template
                          Toolkit distribution. They are now available from CPAN in a separate <a
                          href="http://search.cpan.org/search?query=Template::GD&mode=all">Template::GD</a> distribution.
                        </p>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_HTML" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">HTML</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/HTML.html">HTML</a> plugin
                          is very basic, implementing a few useful methods for generating HTML. It
                          is likely to be extended in the future or integrated with a larger
                          project to generate HTML elements in a generic way.
                        </p>
                        <pre><span class="tt">[% USE HTML %]</span>
<span class="tt">[% HTML.escape("if (a &lt; b &amp;&amp; c &gt; d) ..." %]</span>
<span class="tt">[% HTML.attributes(border =&gt; 1, cellpadding =&gt; 2) %]</span>
<span class="tt">[% HTML.element(table =&gt; { border =&gt; 1, cellpadding =&gt; 2 }) %]</span></pre>
                        <p>
                          See <a href="../modules/Template/Plugin/HTML.html">Template::Plugin::HTML</a> for further details.
                        </p>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Iterator" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Iterator</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Iterator.html">Iterator</a> plugin provides a way to create a <a href="../modules/Template/Iterator.html">Template::Iterator</a> object to
                          iterate over a data set. An iterator is created automatically by the
                          <code>FOREACH</code> directive and is aliased to the <code>loop</code>
                          variable. This plugin allows an iterator to be explicitly created with a
                          given name, or the default plugin name, <code>iterator</code>. See <a
                          href="../modules/Template/Plugin/Iterator.html">Template::Plugin::Iterator</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE iterator(list, args) %]</span>

<span class="tt">[% FOREACH item = iterator %]</span>
   <span class="tt">[% '&lt;ul&gt;' IF iterator.first %]</span>
   &lt;li&gt;<span class="tt">[% item %]</span>
   <span class="tt">[% '&lt;/ul&gt;' IF iterator.last %]</span>
<span class="tt">[% END %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Pod" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Pod</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          This plugin provides an interface to the <a href="http://search.cpan.org/search?query=Pod::POM&mode=all">Pod::POM</a> module which parses POD documents into an internal
                          object model which can then be traversed and presented through the
                          Template Toolkit.
                        </p>
                        <pre><span class="tt">[% USE Pod(podfile) %]</span>

<span class="tt">[% FOREACH head1 = Pod.head1;
     FOREACH head2 = head1/head2;
       ...
     END;
   END
%]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Scalar" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Scalar</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The Template Toolkit calls user-defined subroutines and object methods
                          using Perl's array context by default.
                        </p>
                        <pre># TT2 calls object methods in array context by default
<span class="tt">[% object.method %]</span></pre>
                        <p>
                          This plugin module provides a way for you to call subroutines and methods
                          in scalar context.
                        </p>
                        <pre><span class="tt">[% USE scalar %]</span>

# force it to use scalar context
<span class="tt">[% object.scalar.method %]</span>

# also works with subroutine references
<span class="tt">[% scalar.my_sub_ref %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_String" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">String</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/String.html">String</a>
                          plugin implements an object-oriented interface for manipulating strings.
                          See <a href="../modules/Template/Plugin/String.html">Template::Plugin::String</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE String 'Hello' %]</span>
<span class="tt">[% String.append(' World') %]</span>

<span class="tt">[% msg = String.new('Another string') %]</span>
<span class="tt">[% msg.replace('string', 'text') %]</span>

The string "<span class="tt">[% msg %]</span>" is <span class="tt">[% msg.length %]</span> characters long.</pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Table" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Table</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Table.html">Table</a>
                          plugin allows you to format a list of data items into a virtual table by
                          specifying a fixed number of rows or columns, with an optional overlap.
                          See <a href="../modules/Template/Plugin/Table.html">Template::Plugin::Table</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE table(list, rows=10, overlap=1) %]</span>

<span class="tt">[% FOREACH item = table.col(3) %]</span>
   <span class="tt">[% item %]</span>
<span class="tt">[% END %]</span></pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_URL" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">URL</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/URL.html">URL</a> plugin
                          provides a simple way of contructing URLs from a base part and a variable
                          set of parameters. See <a href="../modules/Template/Plugin/URL.html">Template::Plugin::URL</a> for further details.
                        </p>
                        <pre><span class="tt">[% USE mycgi = url('/cgi-bin/bar.pl', debug=1) %]</span>

<span class="tt">[% mycgi %]</span>
   # ==&gt; /cgi/bin/bar.pl?debug=1

<span class="tt">[% mycgi(mode='submit') %]</span>
   # ==&gt; /cgi/bin/bar.pl?mode=submit&amp;debug=1</pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_Wrap" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">Wrap</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <a href="../modules/Template/Plugin/Wrap.html">Wrap</a> plugin
                          uses the <a href="http://search.cpan.org/search?query=Text::Wrap&mode=all">Text::Wrap</a> module to
                          provide simple paragraph formatting. See <a href="../modules/Template/Plugin/Wrap.html">Template::Plugin::Wrap</a> and
                          <a href="http://search.cpan.org/search?query=Text::Wrap&mode=all">Text::Wrap</a> for further
                          details.
                        </p>
                        <pre><span class="tt">[% USE wrap %]</span>
<span class="tt">[% wrap(mytext, 40, '* ', '  ') %]</span>    # use wrap sub
<span class="tt">[% mytext FILTER wrap(40) -%]</span>    # or wrap FILTER</pre>
                        <p>
                          The <code>Text::Wrap</code> module is available from CPAN:
                        </p>
                        <pre>http://www.cpan.org/modules/by-module/Text/</pre>
                  </div>
                </div>    <div class="subsection">
                  <div class="head">
                    <h2 id="section_XML" onclick="switch_subsection(this)" title="Click title to show/hide sub-section content.">XML</h2>
                    <a href="#body" class="top" title="Back up to the top of the page" >Top</a>
                  </div>
                  <div class="body">
                    <p>
                          The <code>XML::DOM</code>, <code>XML::RSS</code>,
                          <code>XML::Simple</code> and <code>XML::XPath</code> plugins are no
                          longer distributed with the Template Toolkit as of version 2.15
                        </p>
                        <p>
                          They are now available in a separate <a href="http://search.cpan.org/search?query=Template::XML&mode=all">Template::XML</a> distribution.
                        </p>
                  </div>
                </div>
              </div>
            </div>
            
            </div></div>
          <br class="clear" />
          <div class="pageinfo">
            <a href="http://template-toolkit.org/docs/manual/Plugins.html">http://template-toolkit.org/docs/manual/Plugins.html</a>
          </div>
        </div>
        
        <div id="footer">
          <a href="http://opensource.org/" class="osi"></a>
          <div class="controls">
          <div class="pager">
            <a href="../manual/Filters.html" title="Template::Manual::Filters" class="go back">Back<span class="about"><h4>Template::Manual::Filters</h4></span></a>
            <a href="../manual/index.html" title="Template::Manual" class="go up">Up<span class="about"><h4>Template::Manual</h4></span></a>
            <a href="../manual/Internals.html" title="Template::Manual::Internals" class="go next">Next<span class="about"><h4>Template::Manual::Internals</h4></span></a>
          </div>
          </div>
          <div class="copyright">
            Copyright &copy; 1996-2012 <a href="http://wardley.org/">Andy Wardley</a>.  All Rights Reserved.
          </div>
          <div class="licence">
            The <a href="http://template-toolkit.org/">Template Toolkit</a> is <a href="http://opensource.org/">Open Source</a> software.
            You can redistribute and/or modify it under the terms of the <a href="http://www.opensource.org/licenses/gpl-license.php">GNU Public Licence</a>
            or the <a href="http://www.opensource.org/licenses/artistic-license.php">Perl Artistic Licence</a>.
          </div>
        </div>
        <div id="palette">
          <ul>
            <li class="first"><a href="#" class="blue" onclick="set_style('Clear Blue')"></a></li>
            <li><a href="#" class="orange" onclick="set_style('Clear Orange')"></a></li>
            <li><a href="#" class="green" onclick="set_style('Clear Green')"></a></li>
            <li><a href="#" class="purple" onclick="set_style('Clear Purple')"></a></li>
            <li><a href="#" class="grey" onclick="set_style('Clear Grey')"></a></li>
          </ul>
        </div>
    </div>  </body>
</html>