| 1 | # PurpleWiki::Template::TT.pm | ||
| 2 | # | ||
| 3 | # $Id: TT.pm 445 2004-08-05 08:31:23Z eekim $ | ||
| 4 | # | ||
| 5 | # Copyright (c) Blue Oxen Associates 2002-2004. All rights reserved. | ||
| 6 | # | ||
| 7 | # This file is part of PurpleWiki. PurpleWiki is derived from: | ||
| 8 | # | ||
| 9 | # UseModWiki v0.92 (c) Clifford A. Adams 2000-2001 | ||
| 10 | # AtisWiki v0.3 (c) Markus Denker 1998 | ||
| 11 | # CVWiki CVS-patches (c) Peter Merel 1997 | ||
| 12 | # The Original WikiWikiWeb (c) Ward Cunningham | ||
| 13 | # | ||
| 14 | # PurpleWiki is free software; you can redistribute it and/or modify | ||
| 15 | # it under the terms of the GNU General Public License as published by | ||
| 16 | # the Free Software Foundation; either version 2 of the License, or | ||
| 17 | # (at your option) any later version. | ||
| 18 | # | ||
| 19 | # This program is distributed in the hope that it will be useful, | ||
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 22 | # GNU General Public License for more details. | ||
| 23 | # | ||
| 24 | # You should have received a copy of the GNU General Public License | ||
| 25 | # along with this program; if not, write to the | ||
| 26 | # Free Software Foundation, Inc. | ||
| 27 | # 59 Temple Place, Suite 330 | ||
| 28 | # Boston, MA 02111-1307 USA | ||
| 29 | |||
| 30 | package PurpleWiki::Template::TT; | ||
| 31 | |||
| 32 | use 5.005; | ||
| 33 | use strict; | ||
| 34 | use base 'PurpleWiki::Template::Base'; | ||
| 35 | use IO::Select; | ||
| 36 | use IPC::Open3; | ||
| 37 | use Template; | ||
| 38 | |||
| 39 | our $VERSION; | ||
| 40 | $VERSION = sprintf("%d", q$Id: TT.pm 445 2004-08-05 08:31:23Z eekim $ =~ /\s(\d+)\s/); | ||
| 41 | |||
| 42 | sub process { | ||
| 43 | my $self = shift; | ||
| 44 | my $file = shift; | ||
| 45 | my $template = Template->new({ INCLUDE_PATH => [ $self->templateDir ], | ||
| 46 | POST_CHOMP => 1 }) || | ||
| 47 | die Template->error(), "\n"; | ||
| 48 | my $output; | ||
| 49 | |||
| 50 | if ($template->process("$file.tt", $self->vars, \$output)) { | ||
| 51 | return $output; | ||
| 52 | } else { | ||
| 53 | die $template->error(), "\n"; | ||
| 54 | } | ||
| 55 | # FIXME: Need to exit gracefully if error is returned. | ||
| 56 | } | ||
| 57 | |||
| 58 | 1; | ||
| 59 | __END__ |