« lib/Template/EmbeddedPerl/Compiled.pm
↑ Summary
examples/contacts/typed/lib/Contacts/Typed/App.pm »
| 1 | package Contacts::Untyped::App; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 3 | ▶ | use File::Basename qw(dirname); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 3 | ▶ | use File::Spec; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 3 | ▶ | use Template::EmbeddedPerl; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 11 | 3 | my ($class, %args) = @_; | |||||||||||||||||||
| 12 | 3 | ▶ | my $root = $args{root} || File::Spec->rel2abs( | ||||||||||||||||||
|
Condition33%1/3
$args{'root'} || 'File::Spec'->rel2abs('File::Spec'->catdir(dirname(__FILE__), ('..', '..', '..')))
MC/DC0%0/2
$args{'root'} || 'File::Spec'->rel2abs('File::Spec'->catdir(dirname(__FILE__), ('..', '..', '..')))
$args{'root'}
'File::Spec'->rel2abs('File::Spec'->catdir(dirname(__FILE__), ('..', '..', '..')))
Truth table33%1/3
A || B
A= $args{'root'}B= 'File::Spec'->rel2abs('File::Spec'->catdir(dirname(__FILE__), ('..', '..', '..')))
| |||||||||||||||||||||
| 13 | File::Spec->catdir(dirname(__FILE__), qw(.. .. ..)), | ||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 3 | my $self = bless { | |||||||||||||||||||
| 17 | root => $root, | ||||||||||||||||||||
| 18 | heading_calls => 0, | ||||||||||||||||||||
| 19 | }, $class; | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | $self->{engine} = Template::EmbeddedPerl->new( | ||||||||||||||||||||
| 22 | directories => [File::Spec->catdir($root, 'templates')], | ||||||||||||||||||||
| 23 | smart_lines => 1, | ||||||||||||||||||||
| 24 | auto_escape => 1, | ||||||||||||||||||||
| 25 | use_cache => 1, | ||||||||||||||||||||
| 26 | helpers => { | ||||||||||||||||||||
| 27 | 4 | ▶ | display_heading => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 4 | my ($engine, $value) = @_; | |||||||||||||||||||
| 29 | 4 | $self->{heading_calls}++; | |||||||||||||||||||
| 30 | 4 | return uc $value; | |||||||||||||||||||
| 31 | }, | ||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||
| 33 | 3 | ); | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 3 | return $self; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 5 | ▶ | sub contacts { | ||||||||||||||||||
|
Subroutine
contacts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 39 | return [ | ||||||||||||||||||||
| 40 | 5 | {name => '<Ada>', email => 'ada@example.test'}, | |||||||||||||||||||
| 41 | {name => 'Grace', email => 'grace@example.test'}, | ||||||||||||||||||||
| 42 | ]; | ||||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 3 | ▶ | sub heading_calls { $_[0]->{heading_calls} } | ||||||||||||||||||
|
Subroutine
heading_calls: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 5 | ▶ | sub render { | ||||||||||||||||||
|
Subroutine
render: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 48 | 5 | my ($self, %args) = @_; | |||||||||||||||||||
| 49 | 5 | return $self->{engine}->from_file('pages/contacts')->render( | |||||||||||||||||||
| 50 | contacts => $self->contacts, | ||||||||||||||||||||
| 51 | %args, | ||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 3 | 1; | |||||||||||||||||||