Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please help me name my text template module...

7 views
Skip to first unread message

Brian Katzung

unread,
Oct 9, 2012, 3:07:53 PM10/9/12
to module-...@perl.org
My previous message appears to have gone to the bit bucket (no sign of it in almost 24 hours; my apologies if this pops up as a repost).

My "yet another text template module" has these as some major design goals:
  • Absolutely bare-bones syntax (it is my hope that even non-programmer users (with some limited training) can edit templates)
  • "String-sized" templates (like "useful and still fits in a varchar(255)")
  • Control over maximum text length and number of template "steps" executed in order to prevent accidental or malicious denial-of-service attacks
It is content agnostic, and initially targeted toward application message localization, but there is nothing that makes it specific to that use. I plan on using it in a CMS system I'm developing, but there's nothing that makes it specific to that either. It's not a derivative of another template system. (I searched CPAN for template-related stuff, including Template::Toolkit and company, Text::Template, and (HTML::)Mason and didn't see anything similar; if I missed another similar package, I would love to hear about that too.)

I've been developing under "Text::TemplateLite" (for light-weight syntax, size, and resource usage), but I realize it's yet another one of those "Simple, Easy, Reduced, Tiny,..." names and I'm hoping someone can share some specific wisdom rather than general guidelines.

  - Brian
-- 
Brian Katzung, Kappa Computer Solutions, LLC
Offering web, client/server, open source, and traditional
software development and mixed operating system support
for business, education, and science
Phone: 847.412.0713  http://www.kappacs.com

Daniel Staal

unread,
Oct 9, 2012, 3:23:11 PM10/9/12
to module-...@perl.org
On 2012-10-09 15:07, Brian Katzung wrote:
> My previous message appears to have gone to the bit bucket (no sign
> of it in almost 24 hours; my apologies if this pops up as a repost).
>
> My "yet another text template module" has these as some major design
> goals:
>
> * Absolutely bare-bones syntax (it is my hope that even
> non-programmer users (with some limited training) can edit templates)
> * "String-sized" templates (like "useful and still fits in a
> varchar(255)")
>
> * Control over maximum text length and number of template "steps"
> executed in order to prevent accidental or malicious
> denial-of-service
> attacks
>
> It is content agnostic, and initially targeted toward application
> message localization, but there is nothing that makes it specific to
> that use. I plan on using it in a CMS system I'm developing, but
> there's nothing that makes it specific to that either. It's not a
> derivative of another template system. (I searched CPAN for
> template-related stuff, including Template::Toolkit and company,
> Text::Template, and (HTML::)Mason and didn't see anything similar; if
> I missed another similar package, I would love to hear about that
> too.)
>
> I've been developing under "Text::TemplateLite" (for light-weight
> syntax, size, and resource usage), but I realize it's yet another one
> of those "Simple, Easy, Reduced, Tiny,..." names and I'm hoping
> someone can share some specific wisdom rather than general
> guidelines.

I'd honestly try coming up with some semi-random name for it; either a
random acronym (i.e. BASTT - Brian's Awesome Text Templates) or just
open a dictionary and pick a word at random. There are enough
templating systems out there that trying to pick a meaningful name for
it is probably meaningless. Then release it under
Text::YourAwesomeName.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯

unread,
Oct 10, 2012, 4:04:32 PM10/10/12
to module-...@perl.org
> It is content agnostic, and initially targeted toward application
> message localization
This whole description is too abstract to inspire a name. Maybe show
your code? What is your software's unique or decisive feature?

> I searched CPAN for
> template-related stuff […] if
> I missed another similar package, I would love to hear about that
<http://illusori.co.uk/blog/categories/template-roundup/> collects and
compares many templating systems.
signature.asc

Aristotle Pagaltzis

unread,
Nov 13, 2012, 8:12:12 AM11/13/12
to module-...@perl.org
* Brian Katzung <bri...@kappacs.com> [2012-10-09 21:10]:
> Absolutely bare-bones syntax (it is my hope that even non-programmer
> users (with some limited training) can edit templates)

Looking at your docs, to be frank, I don’t think you succeed at this
one. In my experience, non-programmers do best with Template Toolkit
syntax that limits itself to the most basic features, i.e. basically
Template::Simple or Template::Tiny. Function calls like you have are
programming, and punctuation-heavy syntax scares them. Of course, if
you administer training, you will overcome this to some extent, thus
maybe for your own purposes TemplateLite’s misses in this department
are not apparent.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

Brian Katzung

unread,
Nov 14, 2012, 4:01:00 PM11/14/12
to Aristotle Pagaltzis, module-...@perl.org
On 2012-11-13 07:12, Aristotle Pagaltzis wrote:
> * Brian Katzung <bri...@kappacs.com> [2012-10-09 21:10]:
>> Absolutely bare-bones syntax (it is my hope that even non-programmer
>> users (with some limited training) can edit templates)
>
> Looking at your docs, to be frank, I don’t think you succeed at this
> one. In my experience, non-programmers do best with Template Toolkit
> syntax that limits itself to the most basic features, i.e. basically
> Template::Simple or Template::Tiny. Function calls like you have are
> programming, and punctuation-heavy syntax scares them. Of course, if
> you administer training, you will overcome this to some extent, thus
> maybe for your own purposes TemplateLite’s misses in this department
> are not apparent.
>
> Regards

Thank you for your note, Aristotle.

Here's what I would consider a typical use case for Text::TemplateLite:
"nicely" displaying the number of matches returned by a query using
Template and Text::TemplateLite:


# The Template Toolkit template:
my $tt_tpl = q{Your search returned [% IF m == 0 %]no matches[%
ELSIF m == 1 %]1 match[% ELSE %][% m %] matches[% END %].};

# The Text::TemplateLite template:
my $tl_tpl = q{Your search returned <<??(=($m, 0), 'no matches',
=($m, 1), '1 match', $m' matches')>>.};
# (Substitute "ifel" for "??" if desired)


From reading the docs, I don't see how to do this at all using
Template::Simple, and Template::Tiny doesn't like the conditionals (per
its documentation, and confirmed in my testing).

I would say that "if condition/elsif condition/else/end" is programming
too, and it looks to me like there's plenty of punctuation to go around.
The T:TL syntax has the benefit of being easily "balance"-checkable in
an editor such as vim.

I'm expecting that most users will use an existing template as a
prototype, and that the remaining users won't be too shaken by a syntax
I believe is pretty close to a spreadsheet cell formula. I guess time
will tell. :-)

Aristotle Pagaltzis

unread,
Nov 15, 2012, 3:46:00 AM11/15/12
to module-...@perl.org
* Brian Katzung <bri...@kappacs.com> [2012-11-14 22:15]:
> Here's what I would consider a typical use case for
> Text::TemplateLite: "nicely" displaying the number of matches
> returned by a query using Template and Text::TemplateLite:
>
>
> # The Template Toolkit template:
> my $tt_tpl = q{Your search returned [% IF m == 0 %]no matches[%
> ELSIF m == 1 %]1 match[% ELSE %][% m %] matches[% END %].};
>
> # The Text::TemplateLite template:
> my $tl_tpl = q{Your search returned <<??(=($m, 0), 'no matches',
> =($m, 1), '1 match', $m' matches')>>.};
> # (Substitute "ifel" for "??" if desired)

Q.E.D.

> The T:TL syntax has the benefit of being easily "balance"-checkable
> in an editor such as vim.

“Non-programmers” “an editor such as vim”. I see. :-)
0 new messages