File Coverage

blib/lib/OpenGuides/Template.pm
Criterion Covered Total %
statement 226 229 98.6
branch 98 106 92.4
condition 65 89 73.0
subroutine 12 12 100.0
pod 2 2 100.0
total 403 438 92.0


line stmt bran cond sub pod time code
1             package OpenGuides::Template;
2              
3 92     92   27618 use strict;
  92         167  
  92         2668  
4 92     92   463 use vars qw( $VERSION );
  92         190  
  92         4480  
5             $VERSION = '0.20';
6              
7 92     92   484 use Carp qw( croak );
  92         161  
  92         4450  
8 92     92   1744 use CGI; # want to get rid of this and put the burden on the templates
  92         32690  
  92         778  
9 92     92   19085 use OpenGuides; # for $VERSION for template variable
  92         201  
  92         2758  
10 92     92   568 use OpenGuides::CGI;
  92         169  
  92         2179  
11 92     92   77773 use Template;
  92         2014680  
  92         2921  
12 92     92   692 use URI::Escape;
  92         175  
  92         5809  
13 92     92   64221 use Data::Validate::URI qw( is_web_uri );
  92         4402607  
  92         292899  
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