package Template::Provider::DBIC; use strict; use warnings; use base qw/ Template::Provider /; use Carp qw( croak ); use Date::Parse (); our $VERSION = '0.02'; =head1 NAME Template::Provider::DBIC - Load templates using DBIx::Class =head1 SYNOPSIS use My::DBIC::Schema; use Template; use Template::Provider::DBIC; my $schema = My::DBIC::Schema->connect( $dsn, $user, $password, \%options ); my $resultset = $schema->resultset('Template'); If all of your templates are stored in a single table the most convenient method is to pass the provider a L. my $template = Template->new({ LOAD_TEMPLATES => [ Template::Provider::DBIC->new({ RESULTSET => $resultset, # Other template options like COMPILE_EXT... }), ], }); # Process the template 'my_template' from resultset 'Template'. $template->process('my_template'); # Process the template 'other_template' from resultset 'Template'. $template->process('other_template'); Alternatively, where your templates are stored in several tables you can pass a L and specify the result set and template name in the form C. my $template2 = Template->new({ LOAD_TEMPLATES => [ Template::Provider::DBIC->new({ SCHEMA => $schema, # Other template options... }), ], }); # Process the template 'my_template' from resultset 'Template'. $template->process('Template/my_template'); # Process the template 'my_template' from resultset 'Other'. $template->process('Other/my_template'); In cases where both are supplied, the more specific RESULTSET will take precedence. =head1 DESCRIPTION Template::Provider::DBIC allows a L