File Coverage

blib/lib/OpenGuides/Template.pm
Criterion Covered Total %
statement 224 227 98.6
branch 98 106 92.4
condition 65 89 73.0
subroutine 12 12 100.0
pod 2 2 100.0
total 401 436 91.9


line stmt bran cond sub pod time code
1             package OpenGuides::Template;
2              
3 91     91   32808 use strict;
  91         137  
  91         3857  
4 91     91   636 use vars qw( $VERSION );
  91         170  
  91         5283  
5             $VERSION = '0.19';
6              
7 91     91   438 use Carp qw( croak );
  91         146  
  91         5250  
8 91     91   1953 use CGI; # want to get rid of this and put the burden on the templates
  91         42302  
  91         731  
9 91     91   17667 use OpenGuides; # for $VERSION for template variable
  91         191  
  91         2729  
10 91     91   503 use OpenGuides::CGI;
  91         211  
  91         1967  
11 91     91   57315 use Template;
  91         1794794  
  91         3137  
12 91     91   831 use URI::Escape;
  91         208  
  91         5998  
13 91     91   49457 use Data::Validate::URI qw( is_web_uri );
  91         3952340  
  91         271896  
14              
15             =head1 NAME
16              
17             OpenGuides::Template - Do Template Toolkit related stuff for OpenGuides applications.
18              
19             =head1 DESCRIPTION
20              
21             Does all the Template Toolkit stuff for OpenGuides. Distributed and
22             installed as part of the OpenGuides project, not intended for
23             independent installation. This documentation is probably only useful
24             to OpenGuides developers.
25              
26             =head1 SYNOPSIS
27              
28             use OpenGuides::Config;
29             use OpenGuides::Utils;
30             use OpenGuides::Template;
31              
32             my $config = OpenGuides::Config->new( file => "wiki.conf" );
33             my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
34              
35             print OpenGuides::Template->output( wiki => $wiki,
36             config => $config,
37             template => "node.tt",
38             vars => { foo => "bar" }
39             );
40              
41             =head1 METHODS
42              
43             =over 4
44              
45             =item B
46              
47             print OpenGuides::Template->output( wiki => $wiki,
48             config => $config,
49             template => "node.tt",
50             content_type => "text/html",
51             cookies => $cookie,
52             vars => {foo => "bar"},
53             noheaders => 1
54             );
55              
56             Returns everything you need to send to STDOUT, including the
57             Content-Type: header. Croaks unless C