File Coverage

blib/lib/Template/Provider/CustomDBIC.pm
Criterion Covered Total %
statement 15 75 20.0
branch 0 34 0.0
condition 0 38 0.0
subroutine 5 9 55.5
pod 1 1 100.0
total 21 157 13.3


line stmt bran cond sub pod time code
1             package Template::Provider::CustomDBIC;
2              
3 2     2   11012 use strict;
  2         4  
  2         59  
4 2     2   12 use warnings;
  2         4  
  2         64  
5              
6 2     2   10 use base qw/ Template::Provider /;
  2         4  
  2         1336  
7              
8 2     2   29859 use Carp qw( croak );
  2         5  
  2         106  
9 2     2   998 use Date::Parse ();
  2         15590  
  2         2004  
10              
11             our $VERSION = '0.05';
12              
13             =head1 NAME
14              
15             Template::Provider::CustomDBIC - Load templates using DBIx::Class
16              
17              
18             =head1 SYNOPSIS
19              
20             use My::CustomDBIC::Schema;
21             use Template;
22             use Template::Provider::CustomDBIC;
23              
24             my $schema = My::CustomDBIC::Schema->connect(
25             $dsn, $user, $password, \%options
26             );
27             my $resultset = $schema->resultset('Template');
28              
29             If all of your templates are stored in a single table the most convenient
30             method is to pass the provider a L.
31              
32             my $template = Template->new({
33             LOAD_TEMPLATES => [
34             Template::Provider::CustomDBIC->new({
35             RESULTSET => $resultset,
36             # Other template options like COMPILE_EXT...
37             }),
38             ],
39             });
40              
41             # Process the template in 'column' referred by reference from resultset 'Template'.
42             $template->process('table/reference/column');
43              
44              
45             =head1 DESCRIPTION
46              
47             Template::Provider::CustomDBIC allows a L