Template::TAL::Provider - Base class for TAL template providers


Template-TAL documentation Contained in the Template-TAL distribution.

Index


Code Index:

NAME

Top

Template::TAL::Provider - Base class for TAL template providers

SYNOPSIS

Top

  my $provider = $provider_class->new;
  my $ttt = $provider_class->get_template("foo");

DESCRIPTION

Top

TAL Templates come from Providers. You ask an instance of a provider for a template with a specific name, and it should return a Template::TAL::Template object to you for that template.

This module is the base class of all providers - it should be subclassed by developers who wish to write their own provider - for instance, to serve templates from a database.

SUBCLASSING

Top

The only method you need to implement is get_template, which must return either a Template::TAL::Template object, or undef. If you want to do any module initialisation, override new(). See Template::TAL::Provider::Disk for the simple provider that ships with Template::TAL.

METHODS

Top

new()

creates a new provider

get_template( template name )

Should return a Template::TAL::Template object with the given name, or die if there is no such template.

COPYRIGHT

Top

BUGS

Top

None known. Please see Template::TAL for details of how to report bugs.

SEE ALSO

Top

Template::TAL, Template::TAL::Provider::Disk


Template-TAL documentation Contained in the Template-TAL distribution.
package Template::TAL::Provider;
use warnings;
use strict;
use Carp qw( croak );

sub new {
  return bless {}, shift;
}

sub get_template {
  croak('Template::TAL::Provider is abstract - use a subclass');
}

1;