| 1 | package CGI::Lazy::Template; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use HTML::Template; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use CGI::Lazy::Globals; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use CGI::Lazy::Template::Boilerplate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub boilerplate { | ||||||||||||||||||||||||||
|
Subroutine
boilerplate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 11 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 12 | 0 | my $widget = shift; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | return CGI::Lazy::Template::Boilerplate->new($self, $widget); | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 18 | 1 | ▶ | sub config { | ||||||||||||||||||||||||||
|
Subroutine
config: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | return $self->q->config; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 25 | 1 | ▶ | sub q { | ||||||||||||||||||||||||||
|
Subroutine
q: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | return $self->{_q}; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 32 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 34 | 1 | my $q = shift; | |||||||||||||||||||||||||||
| 35 | 1 | my $tmplname = shift; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1 | my $self = {_q => $q, _tmplname => $tmplname}; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 1 | bless $self, $class; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | ▶ | if ($self->config->tmplDir && $tmplname) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->config->tmplDir and $tmplname
MC/DC0%0/2
$self->config->tmplDir and $tmplname
$self->config->tmplDir
$tmplname
Truth table33%1/3
A and B
A= $self->config->tmplDirB= $tmplname
| |||||||||||||||||||||||||||||
| 43 | 0 | eval { | |||||||||||||||||||||||||||
| 44 | 0 | $self->{_template} = HTML::Template->new( | |||||||||||||||||||||||||||
| 45 | filename => $self->config->tmplDir."/".$tmplname, | ||||||||||||||||||||||||||||
| 46 | die_on_bad_params => 0, | ||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||
| 48 | }; | ||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | $self->q->errorHandler->tmplCreateError; | |||||||||||||||||||||||||||
| 53 | 0 | exit; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 1 | return $self; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub process { | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 62 | 0 | my $vars = shift; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | eval { | |||||||||||||||||||||||||||
| 65 | 0 | $self->template->param($vars); | |||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | $self->q->errorHandler->tmplParamError($self->tmplName); | |||||||||||||||||||||||||||
| 70 | 0 | exit; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | my $output; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | eval { | |||||||||||||||||||||||||||
| 76 | 0 | $output = $self->template->output; | |||||||||||||||||||||||||||
| 77 | }; | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | $self->q->errorHandler->tmplParamError($self->tmplName); | |||||||||||||||||||||||||||
| 81 | 0 | exit; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | return $output; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub template { | ||||||||||||||||||||||||||
|
Subroutine
template: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | return $self->{_template}; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub tmplName { | ||||||||||||||||||||||||||
|
Subroutine
tmplName: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 96 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | return $self->{_tmplname}; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 1 | 1 | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | __END__ | ||||||||||||||||||||||||||||