1 package Apache::MVC::View::TT;
2 use Lingua::EN::Inflect;
5 use UNIVERSAL::moniker;
8 sub new { bless {}, shift } # Not worth having
12 my $root = $r->config->{template_root};
13 Template->new({ INCLUDE_PATH => [
15 File::Spec->catdir($root, $r->model_class->moniker),
16 File::Spec->catdir($root, "custom"),
17 File::Spec->catdir($root, "factory")
25 class => $r->model_class,
26 objects => $r->objects,
30 # User-friendliness facility for custom template writers.
31 if (@{$r->objects} > 1){
32 $args{$r->model_class->plural_moniker} = $r->objects;
34 ($args{$r->model_class->moniker}) = @{$r->objects};
41 my $template = $self->_tt($r);
43 $template->process($r->template, { $self->_args($r) }, \$output)
44 || $self->error($r, $template->error);
45 $r->{ar}->content_type("text/html");
46 $r->{ar}->headers_out->set("Content-Length" => length $output);
53 my ($self, $r, $error) = @_;
54 $r->{ar}->content_type("text/plain");