X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FTT.pm;h=f545ea434ff6fc397c655130e79d13ed508c6d84;hb=ee06e29a8475f5dd926aa81c6fcce4f75b7d7585;hp=a8a1b27dade200ae257de7d1175397da347dbb09;hpb=dd53ec3321f39d0423f5b3c538445779c9a5e5f3;p=catagits%2FCatalyst-View-TT.git diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index a8a1b27..f545ea4 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -10,12 +10,13 @@ use Template::Timer; use MRO::Compat; use Scalar::Util qw/blessed weaken/; -our $VERSION = '0.40'; +our $VERSION = '0.41'; $VERSION = eval $VERSION; __PACKAGE__->mk_accessors('template'); __PACKAGE__->mk_accessors('expose_methods'); __PACKAGE__->mk_accessors('include_path'); +__PACKAGE__->mk_accessors('content_type'); *paths = \&include_path; @@ -229,7 +230,8 @@ sub process { } unless ( $c->response->content_type ) { - $c->response->content_type('text/html; charset=utf-8'); + my $default = $self->content_type || 'text/html; charset=utf-8'; + $c->response->content_type($default); } $c->response->body($output); @@ -624,6 +626,18 @@ Then in the template: [% uri_for_css('home.css') %] +=head2 content_type + +This lets you override the default content type for the response. If you do +not set this and if you do not set the content type in your controllers, the +default is C. + +Use this if you are creating alternative view responses, such as text or JSON +and want a global setting. + +Any content type set in your controllers before calling this view are respected +and have priority. + =head2 C Allows you to change the name of the Catalyst context object. If set, it will also