From fa5fa71ef1f3e860c77f385bb663a93708068c14 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 20 Jul 2010 14:14:18 +0200 Subject: [PATCH] UCW::Temple::CGI: Added html_template(). --- UCW/Temple/CGI.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UCW/Temple/CGI.pm b/UCW/Temple/CGI.pm index 0dc71c5..624f7e0 100644 --- a/UCW/Temple/CGI.pm +++ b/UCW/Temple/CGI.pm @@ -8,11 +8,12 @@ use strict; use warnings; use UCW::Temple; +use UCW::CGI; require Exporter; our $VERSION = 1.0; our @ISA = qw(Exporter); -our @EXPORT = qw(out template shipout); +our @EXPORT = qw(out template html_template shipout); our @EXPORT_OK = qw(); our @out_buffer = (); @@ -25,6 +26,12 @@ sub template($;$) { UCW::Temple::process_string($string, $args); } +sub html_template($$) { + my ($string, $args) = @_; + my %hargs = map { $_ => html_escape($args->{$_}) } keys %$args; + UCW::Temple::process_string($string, \%hargs); +} + sub shipout() { print @out_buffer; @out_buffer = (); -- 2.39.5