| Catalyst-View-TT-Filters-LazyLoader documentation | Contained in the Catalyst-View-TT-Filters-LazyLoader distribution. |
Catalyst::View::TT::Filters::LazyLoader - TT View Class with Template::Filters::LazyLoader support.
package MyApp::View::TT;
use strict;
use base 'Catalyst::View::TT::Filters::LazyLoader';
__PACKAGE__->config({
FILTERS_LAZYLOADER => {
pkg => 'MyApp::TTFilters',
},
});
TT View Class with Template::Filters::LazyLoader support.
this class override new().
Tomohiro Teranishi <tomohiro.teranishi@gmail.com>
| Catalyst-View-TT-Filters-LazyLoader documentation | Contained in the Catalyst-View-TT-Filters-LazyLoader distribution. |
package Catalyst::View::TT::Filters::LazyLoader; use strict; use base qw(Catalyst::View::TT); use Template::Filters::LazyLoader 0.05; our $VERSION = '0.07'; sub new { my ($class, $c, $arguments) = @_; my $lazy = Template::Filters::LazyLoader->new(); my $config = { %{ $class->config->{FILTERS_LAZYLOADER} || {} }, %{ $arguments->{FILTERS_LAZYLOADER} || {} }, }; if ( $config->{base_pkg} ) { $lazy->base_pkg( $config->{base_pkg} ); } elsif( $config->{pkg} ) { $lazy->pkg( $config->{pkg} ); } elsif( $config->{pkgs} ) { $lazy->pkgs( $config->{pkgs} ); } else { die 'please set base_pkg or pkg or pkgs'; } if ( defined $config->{static_filter_prefix} ) { $lazy->static_filter_prefix( $config->{static_filter_prefix} ) } if ( defined $config->{dynamic_filter_prefix} ) { $lazy->dynamic_filter_prefix( $config->{dynamic_filter_prefix} ) } if ( defined $config->{lib_path} ) { $lazy->lib_path( $config->{lib_path} ); } $arguments->{FILTERS} = $lazy->load() ; my $self = $class->SUPER::new($c, $arguments); return $self ; } 1;