develooper Front page | perl.perlpoint | Postings from April 2002

pp2html: template thoughts

From:
Jochen Stenzel
Date:
April 27, 2002 05:41
Subject:
pp2html: template thoughts
Message ID:
171RVM-1PeTYWC@fmrl10.sul.t-online.com
Hello,

for the templates of pp2html, I had a look at the HTML::Template
module. I think it is definitely one of the modules to be taken into
account and only needs a few prerequisites.

But there might be other options like the Template::Toolkit which seems
to be the most powerful alternative, providing even the evaluation of
embedded Perl code. So I suggest the following (first thoughts for
discussion, by no means final or complete):

* Let's abstract the current pp2html output generator code in order to
  establish a clear, documented, generic API. We'll have to figure out
  what data needs to be passed to a generic generator.

* A pp2html option should configure which backend to use. For styles,
  it can be set in the style option files.

* The current implementation could become the first API backend, both
  as a proof of concept and to provide backwards compatibility.

* Another new API backend could use HTML::Template, another one
  Template::Toolkit, etc., so everyone can use what he prefers.
  Users will not even have to know which template system is used,
  they still chose a style by -style.

HTML::Template backend in particular:

* It seems to be small, fast and powerful. If it's not fast enough,
  according to CPAN there's even a JIT compiler around, and if I
  understood it correctly, precompiled templates can be used even
  without an installation of HTML::Template.

* Several additional modules add further features like regular
  expression support.

* It is mostly based on variable substitution, right like the current
  template system. Migration of existing styles should be pretty
  straightforward. Everything possible today should be possible
  with HTML::Template as well.

* Ease of use: in my opinion it is important that users can set up and
  adapt layout styles without long studies. HTML::Template could
provide
  this.

* I'm not sure yet how to support docstreams, possibly by loops and
  conditions?

What do you think?

                Jochen











nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About