]> mj.ucw.cz Git - temple.git/blob - UCW/Temple/CGI.pm
0dc71c5741556339c6c5857413ba82f425c50f9c
[temple.git] / UCW / Temple / CGI.pm
1 #!/usr/bin/perl
2 # Building blocks of CGI's using the UCW::Temple template engine
3 # (c) 2010 Martin Mares <mj@ucw.cz>
4
5 package UCW::Temple::CGI;
6
7 use strict;
8 use warnings;
9
10 use UCW::Temple;
11
12 require Exporter;
13 our $VERSION = 1.0;
14 our @ISA = qw(Exporter);
15 our @EXPORT = qw(out template shipout);
16 our @EXPORT_OK = qw();
17
18 our @out_buffer = ();
19 $T::out_func = sub {
20         push @out_buffer, @_;
21 };
22
23 sub template($;$) {
24         my ($string, $args) = @_;
25         UCW::Temple::process_string($string, $args);
26 }
27
28 sub shipout() {
29         print @out_buffer;
30         @out_buffer = ();
31 }
32
33 42;