Version 0.40
[catagits/Catalyst-View-TT.git] / lib / Catalyst / View / TT.pm
index 5056726..a8a1b27 100644 (file)
@@ -10,7 +10,7 @@ use Template::Timer;
 use MRO::Compat;
 use Scalar::Util qw/blessed weaken/;
 
-our $VERSION = '0.37';
+our $VERSION = '0.40';
 $VERSION = eval $VERSION;
 
 __PACKAGE__->mk_accessors('template');
@@ -33,13 +33,10 @@ Catalyst::View::TT - Template View Class
 
     __PACKAGE__->config(
         # any TT configuration items go here
-        INCLUDE_PATH => [
-          MyApp->path_to( 'root', 'src' ),
-          MyApp->path_to( 'root', 'lib' ),
-        ],
         TEMPLATE_EXTENSION => '.tt',
         CATALYST_VAR => 'c',
         TIMER        => 0,
+        ENCODING     => 'utf-8'
         # Not set by default
         PRE_PROCESS        => 'config/main',
         WRAPPER            => 'site/wrapper',
@@ -47,6 +44,17 @@ Catalyst::View::TT - Template View Class
         expose_methods => [qw/method_in_view_class/],
     );
 
+# add include path configuration in MyApp.pm
+
+    __PACKAGE__->config(
+        'View::Web' => {
+            INCLUDE_PATH => [
+                __PACKAGE__->path_to( 'root', 'src' ),
+                __PACKAGE__->path_to( 'root', 'lib' ),
+            ],
+        },
+    );
+
 # render view from lib/MyApp.pm or lib/MyApp::Controller::SomeController.pm
 
     sub message : Global {
@@ -257,7 +265,7 @@ sub render {
             die $self->template->error if $self->{render_die};
             return $self->template->error;
         }
-        $c->log->debug('The Catalyst::View::TT render() method will start dying on error in a future release. Unless you are calling the render() method manually, you probably want the new behaviour, so set render_die => 1 in config for ' . blessed($self) . '. If you wish to continue to return the exception rather than throwing it, add render_die => 0 to your config.') if $c->debug;
+        $c->log->debug('The Catalyst::View::TT render() method will start dying on error in a future release. Unless you are calling the render() method manually, you probably want the new behaviour, so set render_die => 1 in config for ' . blessed($self) . '. If you wish to continue to return the exception rather than throwing it, add render_die => 0 to your config.') if $c && $c->debug;
         return $self->template->error;
     }
     return $output;
@@ -318,11 +326,9 @@ replacing C<MyApp> with the name of your application) which looks
 something like this:
 
     package FooBar::View::Web;
+    use Moose;
 
-    use strict;
-    use warnings;
-
-    use base 'Catalyst::View::TT';
+    extends 'Catalyst::View::TT';
 
     __PACKAGE__->config(DEBUG => 'all');
 
@@ -445,6 +451,12 @@ If you are calling C<render> directly then you can specify dynamic paths by
 having a C<additional_template_paths> key with a value of additonal directories
 to search. See L<CAPTURING TEMPLATE OUTPUT> for an example showing this.
 
+=head2 Unicode
+
+Be sure to set C<< ENCODING => 'utf-8' >> and use
+L<Catalyst::Plugin::Unicode::Encoding> if you want to use non-ascii
+characters (encoded as utf-8) in your templates.
+
 =head2 RENDERING VIEWS
 
 The view plugin renders the template specified in the C<template>
@@ -704,9 +716,8 @@ Allows you to specify a custom class to use as the template class instead of
 L<Template>.
 
     package MyApp::View::Web;
-
-    use strict;
-    use base 'Catalyst::View::TT';
+    use Moose;
+    extends 'Catalyst::View::TT';
 
     use Template::AutoFilter;