blib/lib/CGI/FormBuilder/Template.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 15 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 ###########################################################################
3 # Copyright (c) Nate Wiger http://nateware.com. All Rights Reserved.
4 # Please visit http://formbuilder.org for tutorials, support, and examples.
5 ###########################################################################
6  
7 package CGI::FormBuilder::Template;
8  
9 =head1 NAME
10  
11 CGI::FormBuilder::Template - Template adapters for FormBuilder
12  
13 =head1 SYNOPSIS
14  
15 # Define a template engine
16  
17 package CGI::FormBuilder::Template::Whatever;
18 use base 'Whatever::Template::Module';
19  
20 sub new {
21 my $self = shift;
22 my $class = ref($self) || $self;
23 my %opt = @_;
24  
25 # override some options
26 $opt{some_setting} = 0;
27 $opt{another_var} = 'Some Value';
28  
29 # instantiate the template engine
30 $opt{engine} = Whatever::Template::Module->new(%opt);
31  
32 return bless \%opt, $class;
33 }
34  
35 sub render {
36 my $self = shift;
37 my $form = shift; # only arg is form object
38  
39 # grab any manually-set template params
40 my %tmplvar = $form->tmpl_param;
41  
42 # example template manipulation
43 my $html = $self->{engine}->do_template(%tmplvar);
44  
45 return $html; # scalar HTML is returned
46 }
47  
48 =cut
49  
50 use strict;
51 use warnings;
52 no warnings 'uninitialized';
53  
54 our $VERSION = '3.10';
55 warn __PACKAGE__, " is not a real module, please read the docs\n";
56 1;
57 __END__