The following module was proposed for inclusion in the Module List:
modid: Template::TPL
DSLIP: bmpOp
description: OO Template Processing Library for HTML,Text
userid: PSCHNELL (Paul Schnell)
chapterid: 11 (String_Lang_Text_Proc)
communities:
similar:
HTML::Template Template::Toolkit HTML::EasyTemplate
rationale:
Template::TPL occupies a 'middle ground' position amid the current
set of template processors available on CPAN. While its primary role
has been that of HTML template processing, it has been used to
prcess text files and text based email message content. It is for
this somewhat varied role that I would like to see it in the
Template:: namespace as opposed to the HTML:: namespace. The module
name itself is an acronym for 'Template Processing Library' and is
handy both for its brevity and use as an object reference:
$tpl = new Template::TPL;
While TPL alone gives no particular meaning to the module
functionality, in the context of the Template:: namespace, with
wider use and the readme, this functionality becomes apparent. I'm
open to suggestions on this one and understand the negative
implications of an acronym based name but feel that Template:: is a
strong pre-cursor from which to derive meaning.
The primary reason for the module's development was the absence of
a simple, easy to use, but reasonably featured module. I've used
both Template::Toolkit and HTML::Mason on various projects and found
them excellent for the more complex tasks. Other modules,
HTML::Template and HTML::EasyTemplate are too syntactically complex
and too functionally simple respectively for the day-to-day work
I've encountered, doing web development for a variety of companies.
Thus Template::TPL is a stand-alone solution with a straight forward
interface.
Functionality summary: - File includes - Optional content - If/Else
blocks - Variable substitution - Loops (nested recursively) - Loop
Optional content - Loop If/else blocks - Data sorting (columns) -
Debugging, Perl scripts and Object data In terms of style and
functionality the closest currently available module is
HTML::Template, a really well written and efficient module. I've
decided to go my own way for 2 main reasons:
1. I was looking for a tag syntax which stood out more in HTML,
rather that 'fit in'. Although the syntax is user-configuarable I
find the default clear and easy to read, it has a useful caveat of
being able to be set to a company name to stamp ownership on source
code: [COMPNAME variable='varname'] (companies tend to like that
sort of thing)
A variable placeholder: ----------------------------- [TPL
variable='varname']
A loop: ----------------------------- [TPL LOOP name='loopname']
[TPL array='foo_val'] [TPL array='bar_val'] [TPL array='baz_val']
[TPL LOOP END]
If/else block: ----------------------------- [TPL IF foo='23'] The
value is 23 [TPL ELSIF foo='42'] The value is 42 [TPL ELSE] I don't
know the value [TPL ENDIF]
2. I wanted a more stream-lined Perl interface leaving the data
structures to be handled internally by the TPL object.
$tpl = new Template::TPL;
$tpl->variable("foo", 23);
$myloop = $tpl->new_loop("loopname"); foreach ( @data ) { my (
$foo, $bar, $baz ) = split; $myloop->array("foo_val", $foo);
$myloop->array("bar_val", $bar); $myloop->array("baz_val", $baz); }
I hope the above is sufficient to warrant the inclusion of
Template::TPL in the module list. It has been in private commercial
use for over a year now and I hope its public release will prove it
usefull to other users and a means to improve the code via wider
scrutiny. I'm planning to upload it a week from this submission.
enteredby: PSCHNELL (Paul Schnell)
enteredon: Wed Aug 8 23:26:37 2001 GMT
The resulting entry would be:
Template::
::TPL bmpOp OO Template Processing Library for HTML,Text PSCHNELL
Thanks for registering,
The Pause Team
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=37000000_cf94c97ab3060fb7&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=37000000_cf94c97ab3060fb7&SUBMIT_pause99_add_mod_insertit=1