__PACKAGE__->mk_accessors('template');
__PACKAGE__->mk_classdata('config');
-__PACKAGE__->config( { EVAL_PERL => 1 } );
+__PACKAGE__->config( { EVAL_PERL => 0 } );
=head1 NAME
=head1 DESCRIPTION
-This is the C<Template> view class.
+This is the C<Template> view class. Your subclass should inherit
+from this class. If you want to override TT config settings, you
+can do it there by setting __PACKAGE__->config->{OPTION} as shown
+in the synopsis. Of interest might be EVAL_PERL, which is disabled
+by default, and LOAD_TEMPLATES, which is set to use the provider.
+
+If you want to use EVAL perl, add something like this:
+
+ __PACKAGE__->config->{EVAL_PERL} = 1;
+ __PACKAGE__->config->{LOAD_TEMPLATES} = undef;
=head2 OVERLOADED METHODS
my $class = shift;
my $c = shift;
my $self = $class->NEXT::new(@_);
+ our ($template, $provider);
my $root = $c->config->{root};
- my %config =
- ( %{ $class->config }, INCLUDE_PATH => [ $root, "$root/base" ] );
+ $provider ||= Template::Provider->new();
+ $provider->include_path([ $root, "$root/base" ]);
+ my %config= ( LOAD_TEMPLATES => [ $provider ],
+ %{ $class->config() },
+ INCLUDE_PATH => [ $root, "$root/base" ]
+ );
$config{CONTEXT} = Template::Timer->new(%config) if $c->debug;
- $self->template( Template->new( \%config ) );
+ $self->template( Template->new(\%config));
return $self;
}