Hi there,

I have a pure perl implementation of a simple templating system which is
(what I consider to be) relatively lightweight - it copes well in both
cgi-bin and mod_perl environments, at least for me. I've looked at various
other modules, and do believe mine brings an alternative slant to the
proceedings 8)

A simple example of it in action (if it were called My::Simple::Template)
would be:

        use My::Simple::Template;
        my $template = new My::Simple::Template;
        $template->tags( { key1 => 'value1', key2 => 'value2' } );
        print $template->generate("/path/to/template.html");

I've been thinking about releasing it for a while (I've just received
permission from my employer to do so) under the GPL/Artistic license,
although I'm pretty nervous about the quality of the code (primarily due to
having not released anything for public scrutiny before!). I know that there
are a few things that could do with a bit of tidying up, however 8)

It's around 300 lines of code (plus docs) and has been tested with perl
5.005 (although it should work with earlier versions with a bit of
fiddling), on under solaris, linux and windows, cgi-bin and mod_perl. I'll
quite happily supply what I currently have to anyone who's interested.

Synopsis of "main" features:

 * in-line insertions with name/value pairs (obviously)
 * loops
 * basic if/else constructs
 * template comments
 * file includes
 * file and database caching of preprocessed templates
 * "loose" expansion of tags
 * "template subroutines" (hard to explain in one line)

Please mail me if you're interested in finding out more

Chris

-----Original Message-----
From: Gunther Birznieks [mailto:[EMAIL PROTECTED]]
Sent: 02 August 2000 09:20
To: [EMAIL PROTECTED]
Subject: RE: Feature sets [was Re: Templating System]


I have to say that I am also interested in template kits myself.

My requirements are almost identical to yours (minus a few advanced things).

Basically, I write open source web applications in Perl -- that means that 
they must be able to run reasonably fast on non-modperl systems and must 
run on a variety of ISPs (ie not dedicated servers where you control the 
version of Perl).

Of course, mod_perl support is crucial for those that want to "scale", but 
normal CGI/Perl support is really a biggie that I haven't seen highlighted 
within the context of this thread.

Here are my CGI/Perl requirements:

1) Must be 100% pure Perl or support pure-Perl alternatives if certain libs 
arent compiled. Many people who download CGI scripts don't know how to 
compile stuff.

2) Must support Perl 5.004 and above. Ideal to support Perl 5.003. Enough 
ISPs and corporations around the world are still on 5.004 that only 
supporting the latest Perl version is not doable.

3) Must incur as minimal load-time as possible. CGI/Perl scripts are not 
cached like mod_perl scripts.

So CGI/Perl people must have a template system that can choose to load a 
minimal amount of code if really advanced features aren't used. IE would 
rather not have a templating system as large as CGI.pm. Or rather it can be 
as large as CGI.pm, but only if the extra code is loaded when advanced 
features are accessed -- normal CGI/Perl users should not be penalized.

4) Must have a license that supports redistribution in other scripts.  I 
think most of the systems out there do that (maybe all the Perl ones do).

CPAN is great for us, but again, most real-world web app users are not CPAN 
savvy and don't have the rights to install global modules on their ISP nor 
the learning to install them locally. So an open source web app that takes 
advantage of a template system really should also contain that template 
system. The power users can remove it from the local dir if they have a 
globally installed version of the system.

Anyway, I felt that I should state these feature requirements because this 
list is so mod_perl centric, I think sometimes we forget the "little" 
people. And there are many more of them out there than mod_perl servers and 
Perl/CPAN savvy people.

<RANT_IN_ADVANCE>And please don't say that they should RTFM. Most users do 
not have time to RTFM. If they did, they would be us. :) These users are 
people who know their business and typically learn just enough tech to 
install something that will help their business -- they don't care or want 
a CS degree in the process.</RANT_IN_ADVANCE>

Later,
    Gunther


_____________________________________________________________________
This message has been checked for all known viruses by UUNET delivered 
through the MessageLabs Virus Control Centre. For further information visit
http://www.uk.uu.net/products/security/virus/

Reply via email to