X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2FMaypole%2FView%2FTT.pm;h=4bd7c0ebb836af2acd0817aba039b1da8b58b7e1;hb=fac297853fb5fe79a5e6ad4190ee5e3e3d1e289d;hp=47999a4692460dc5137c53bbdd8e3d3dd5e223e7;hpb=74800a709376d0ce878cabd9db6b3578c002606c;p=maypole.git diff --git a/lib/Maypole/View/TT.pm b/lib/Maypole/View/TT.pm index 47999a4..4bd7c0e 100644 --- a/lib/Maypole/View/TT.pm +++ b/lib/Maypole/View/TT.pm @@ -11,7 +11,8 @@ sub new { bless {}, shift } # Not worth having sub _tt { my ($self, $r) = @_; - my $root = $r->{ar}->document_root . "/". $r->{ar}->location; + # This bit sucks. + my $root = $r->{config}{template_root} || $r->get_template_root; Template->new({ INCLUDE_PATH => [ $root, ($r->model_class && File::Spec->catdir($root, $r->model_class->moniker)), @@ -62,10 +63,8 @@ sub process { $template->process($r->template, { $self->_args($r) }, \$output) || return $self->error($r, $template->error); - $r->{ar}->content_type("text/html"); - $r->{ar}->headers_out->set("Content-Length" => length $output); - $r->{ar}->send_http_header; - $r->{ar}->print($output); + $r->{content_type} ||= "text/html"; + $r->{output} = $output; return 200; } @@ -73,8 +72,9 @@ sub error { my ($self, $r, $error) = @_; warn $error; if ($error =~ /not found$/) { return DECLINED } - $r->{ar}->send_http_header("text/plain"); - $r->{ar}->print($error); + $r->{content_type} = "text/plain"; + $r->{output} = $error; + $r->send_output; exit; }