| 1 | package Spoon::Template; | ||||||||||
| 2 | 3 | ▶ | use Spoon::Base -Base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use Template; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 3 | const class_id => 'template'; | |||||||||
| 6 | 3 | const template_path => [ './template' ]; | |||||||||
| 7 | 3 | field path => []; | |||||||||
| 8 | 3 | stub 'render'; | |||||||||
| 9 | 3 | field config => -init => '$self->hub->config'; | |||||||||
| 10 | 3 | field cgi => -init => '$self->hub->cgi'; | |||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 1 | $self->add_path(@{$self->template_path}); | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub all { | ||||||||
|
Subroutine
all: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 17 | return ( | ||||||||||
| 18 | 0 | ▶ | $self->config->all, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | $self->is_in_cgi ? ($self->cgi->all) : (), | ||||||||||
| 20 | hub => $self->hub, | ||||||||||
| 21 | ); | ||||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | sub add_path { | ||||||||
|
Subroutine
add_path: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 25 | 1 | for (reverse @_) { | |||||||||
| 26 | 1 | $self->remove_path($_); | |||||||||
| 27 | 1 | unshift @{$self->path}, $_; | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub append_path { | ||||||||
|
Subroutine
append_path: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 32 | 0 | for (@_) { | |||||||||
| 33 | 0 | $self->remove_path($_); | |||||||||
| 34 | 0 | push @{$self->path}, $_; | |||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub remove_path { | ||||||||
|
Subroutine
remove_path: called CC=1 SCAR=0.1
Pod
undocumented
| |||||||||||
| 39 | 1 | my $path = shift; | |||||||||
| 40 | 0 | $self->path([grep {$_ ne $path} @{$self->path}]); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub process { | ||||||||
|
Subroutine
process: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 44 | 0 | my $template = shift; | |||||||||
| 45 | 0 | ▶ | my @templates = (ref $template eq 'ARRAY') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | ? @$template | ||||||||||
| 47 | : $template; | ||||||||||
| 48 | return join '', map { | ||||||||||
| 49 | 0 | $self->render($_, $self->all, @_) | |||||||||
| 50 | } @templates; | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 3 | __END__ | |||||||||