I'm looking for suggestions on how to get a value from my template that can be used in my Perl code. I'd rather not switch to another template module that would provide this since HTML::Template has otherwise met my needs.

The details...

In my template, I'd like to have something like:

<TMPL_VAR NAME="QUERY" VALUE="SELECT col1, col2 FROM table">

and then do something like this in my Perl code:

my $template = HTML::Template->new(filename => 'test.tmpl');
my $value = $template->param('QUERY');

and have $value = "SELECT col1, col2 FROM table"

My three thoughts are:

1. use a filter, but I don't know how to get $template instead of the filter subroutine so I can call $template->param to set the value. The only thing passed to the filter subroutine is the text of the file and not $self?

2. extend HTML::Template to handle this via the existing TMPL_VAR or add a new tag TMPL_DEFINE

3. Use HTML::Template::Expr, but my experience is that ::Expr is slow and I don't need all the other features it would provide.

Comments on the above options or other thoughts on how to do this?

Thanks,
Bill



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to