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=b57d1808c7b9759897e324e21a05cc13dc4ccbc5;hpb=722fede4969a344973ff88e63379bdda545675a5;p=catagits%2FCatalyst-View-TT.git diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index b57d180..f545ea4 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -1,14 +1,24 @@ package Catalyst::View::TT; use strict; -use base qw/Catalyst::Base/; +use warnings; + +use base qw/Catalyst::View/; +use Data::Dump 'dump'; use Template; use Template::Timer; -use NEXT; +use MRO::Compat; +use Scalar::Util qw/blessed weaken/; -our $VERSION = '0.12'; +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; =head1 NAME @@ -16,149 +26,212 @@ Catalyst::View::TT - Template View Class =head1 SYNOPSIS - # use the helper - myapp_create.pl view TT TT +# use the helper to create your View - # lib/MyApp/View/TT.pm - package MyApp::View::TT; + myapp_create.pl view Web TT - use base 'Catalyst::View::TT'; +# add custom configration in View/Web.pm - __PACKAGE__->config->{DEBUG} = 'all'; - - # in practice you'd probably set this from a config file; - # defaults to $c->config->root - __PACKAGE__->config->{INCLUDE_PATH} = - '/usr/local/generic/templates:/usr/local/myapp/templates'; + __PACKAGE__->config( + # any TT configuration items go here + TEMPLATE_EXTENSION => '.tt', + CATALYST_VAR => 'c', + TIMER => 0, + ENCODING => 'utf-8' + # Not set by default + PRE_PROCESS => 'config/main', + WRAPPER => 'site/wrapper', + render_die => 1, # Default for new apps, see render method docs + expose_methods => [qw/method_in_view_class/], + ); - 1; - - # Meanwhile, maybe in a private C action - $c->forward('MyApp::View::TT'); +# add include path configuration in MyApp.pm + __PACKAGE__->config( + 'View::Web' => { + INCLUDE_PATH => [ + __PACKAGE__->path_to( 'root', 'src' ), + __PACKAGE__->path_to( 'root', 'lib' ), + ], + }, + ); -=head1 DESCRIPTION +# render view from lib/MyApp.pm or lib/MyApp::Controller::SomeController.pm -This is the Catalyst view class for the L