]> mj.ucw.cz Git - temple.git/commitdiff
UCW::Temple::CGI: Written
authorMartin Mares <mj@ucw.cz>
Mon, 19 Jul 2010 18:47:46 +0000 (20:47 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 18 Aug 2010 15:20:34 +0000 (17:20 +0200)
UCW/Temple/CGI.pm [new file with mode: 0644]

diff --git a/UCW/Temple/CGI.pm b/UCW/Temple/CGI.pm
new file mode 100644 (file)
index 0000000..0dc71c5
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+# Building blocks of CGI's using the UCW::Temple template engine
+# (c) 2010 Martin Mares <mj@ucw.cz>
+
+package UCW::Temple::CGI;
+
+use strict;
+use warnings;
+
+use UCW::Temple;
+
+require Exporter;
+our $VERSION = 1.0;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(out template shipout);
+our @EXPORT_OK = qw();
+
+our @out_buffer = ();
+$T::out_func = sub {
+       push @out_buffer, @_;
+};
+
+sub template($;$) {
+       my ($string, $args) = @_;
+       UCW::Temple::process_string($string, $args);
+}
+
+sub shipout() {
+       print @out_buffer;
+       @out_buffer = ();
+}
+
+42;