| 1 | package Catalyst::View::TT::Layout; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use base 'Catalyst::View::TT'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use NEXT; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 1 | our $VERSION = '0.01'; | |||||||||||
| 8 | |||||||||||||
| 9 | 0 | ▶ | sub process { | ||||||||||
|
Subroutine
process: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 10 | 0 | my ( $self, $c ) = @_; | |||||||||||
| 11 | |||||||||||||
| 12 | 0 | ▶ | $c->stash->{template_layout} ||= []; | ||||||||||
|
Condition0%0/2
$c->stash->{"template_layout"} ||= []
MC/DC0%0/1
$c->stash->{"template_layout"} ||= []
$c->stash->{"template_layout"}
Truth table0%0/2
A
A= $c->stash->{"template_layout"}
| |||||||||||||
| 13 | 0 | my @layouts = ( @{$c->stash->{template_layout}}, $c->stash->{template} ); | |||||||||||
| 14 | 0 | $c->stash->{LAYOUTS} = \@layouts; | |||||||||||
| 15 | 0 | $c->stash->{template} = shift @layouts; | |||||||||||
| 16 | 0 | return $self->NEXT::process($c); | |||||||||||
| 17 | } | ||||||||||||
| 18 | |||||||||||||
| 19 | =head1 NAME | ||||||||||||
| 20 | |||||||||||||
| 21 | Catalyst::View::TT::Layout - Layout TT template processing | ||||||||||||
| 22 | |||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||
| 24 | |||||||||||||
| 25 | in the appliction: | ||||||||||||
| 26 | |||||||||||||
| 27 | $c->stash->{template_layout} = [ 'main_layout.tpl', 'sub_layout.tpl' ]; | ||||||||||||
| 28 | |||||||||||||
| 29 | in the template files ('main_layout.tpl' and 'sub_layout.tpl'): | ||||||||||||
| 30 | |||||||||||||
| 31 | [% PROCESS $LAYOUTS.shift %] | ||||||||||||
| 32 | |||||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||||
| 34 | |||||||||||||
| 35 | A Layout version of the Catalyst TT view. | ||||||||||||
| 36 | |||||||||||||
| 37 | =head2 OVERRIDDEN METHODS | ||||||||||||
| 38 | |||||||||||||
| 39 | =over 4 | ||||||||||||
| 40 | |||||||||||||
| 41 | =item process | ||||||||||||
| 42 | |||||||||||||
| 43 | Overrides C<process> to let template could be layout. | ||||||||||||
| 44 | |||||||||||||
| 45 | =back | ||||||||||||
| 46 | |||||||||||||
| 47 | =cut | ||||||||||||
| 48 | |||||||||||||
| 49 | =head1 SEE ALSO | ||||||||||||
| 50 | |||||||||||||
| 51 | L<Catalyst>. L<Catalyst::View::TT> | ||||||||||||
| 52 | |||||||||||||
| 53 | =head1 AUTHOR | ||||||||||||
| 54 | |||||||||||||
| 55 | Chunzi, C<chunzi@chunzi.org> | ||||||||||||
| 56 | |||||||||||||
| 57 | =head1 THANK YOU | ||||||||||||
| 58 | |||||||||||||
| 59 | SRI, for writing the awesome Catalyst framework | ||||||||||||
| 60 | |||||||||||||
| 61 | =head1 COPYRIGHT | ||||||||||||
| 62 | |||||||||||||
| 63 | This program is free software, you can redistribute it and/or modify it under | ||||||||||||
| 64 | the same terms as Perl itself. | ||||||||||||
| 65 | |||||||||||||
| 66 | =cut | ||||||||||||
| 67 | |||||||||||||
| 68 | 1 | 1; | |||||||||||