From: Martin Mares Date: Tue, 20 Jul 2010 12:14:18 +0000 (+0200) Subject: UCW::Temple::CGI: Added html_template(). X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=fa5fa71ef1f3e860c77f385bb663a93708068c14;p=temple.git UCW::Temple::CGI: Added html_template(). --- 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 = ();