Comments below.

Sam Tregar wrote:
On Thu, 30 Jan 2003, Timothy Appnel wrote:


Here is the snag. I need to provide a designer
that ability to apply any one or more of a number
of filters that could occur post processing --
lowercase, strip tags, encode xml etc. Trying to
predict and create every possible combination to
pass into the template seems rather inefficent and
an exercise in futility.

Are you sure you need to do that?  I ask only because I've created quite a
few web apps without needing this functionality.

I have also, but this time that is not the case. This app I have lined up needs a template engine that a virtual novice can use to customize the output of content long after I'm out of the picture. Think of a publishing tool like a weblog.

But, sigh, if this is what you need then HTML::Template::Expr is
undoubtably what you need.  Just define the filters as functions and:

  <tmpl_var expr="encode_xml(var)">

I'm still trying to void this. These filters I am envisioning are generally simple regexs.

While these are boolean switches there are a few exceptions such as data formatting. Chris Davies and Smylers suggestions are an interesting one, but I think would be problematic in these situations.

my $content = $template->output();

return &post_filter_processing($content);

That works fine.  It works so well, in face that I've never been
interested in trying to replace it!  People use this technique to
use HTML::Clean on HTML::Template output, for example.

OK. That's what I was verifying before I go and do something dumb like reinvent the wheel.

On a related note, it seems to me that adding a post_filter=> \&post_filter_processing option would be nice for the sake of clarity and cohesion. Not looking at the code first, it seems like it would only add a few lines of code to the module. Am I correct Sam?


I beleive this would reduce caching performance, correct?

I don't think so.  What do you mean exactly?
I think I maybe getting caching confused witht he JIT. Nevertheless, let me restate what I meant. Since I'm executing a routine outside of the HTML::Template module after processing am I defeating or negating the advantages of the caching system? (Does that make more sense?)

<tim/>
--
Timothy Appnel
http://tima.mplode.com/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to