lib/PurpleWiki/Template/Base.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 46 CC 4 SCAR 14.8
CC
4
Cov
0%
new
6.0
templateDir
6.0
vars
6.0
CRAP 4.4
1 # PurpleWiki::Template::Base.pm
2 #
3 # $Id: Base.pm 438 2004-08-01 03:22:53Z 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::Base;
31  
32 use 5.005;
33 use strict;
34 use PurpleWiki::Config;
35  
36 our $VERSION;
37 $VERSION = sprintf("%d", q$Id: Base.pm 438 2004-08-01 03:22:53Z eekim $ =~ /\s(\d+)\s/);
38  
39 ### constructor
40  
41 sub new {
42 my $this = shift;
43 my %options = @_;
44 my $self = {};
45  
46 my $config = PurpleWiki::Config->instance;
47 if ($options{templateDir}) {
48 $self->{templateDir} = $options{templateDir};
49 }
50 else {
51 $self->{templateDir} = $config->TemplateDir;
52 }
53 bless($self, $this);
54 return $self;
55 }
56  
57 ### methods
58  
59 sub templateDir {
60 my $self = shift;
61  
62 $self->{templateDir} = shift if @_;
63 return $self->{templateDir};
64 }
65  
66 sub vars {
67 my $self = shift;
68 my %var = @_;
69  
70 $self->{vars} = \%var if (%var);
71 return $self->{vars};
72 }
73  
74 sub process {
75 die shift() . " didn't define a template method!";
76 }
77  
78 1;
79 __END__