| 1 | package DTL::Fast::Tag::Include; | ||||||||||||||||||||
| 2 | 5 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 5 | ▶ | use parent 'DTL::Fast::Tag::Simple'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 5 | $DTL::Fast::TAG_HANDLERS{'include'} = __PACKAGE__; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 5 | ▶ | use DTL::Fast::Expression; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | #@Override | ||||||||||||||||||||
| 10 | sub new | ||||||||||||||||||||
| 11 | { | ||||||||||||||||||||
| 12 | 17 | ▶ | my( $proto, $parameter, %kwargs ) = @_; | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 13 | 17 | ▶ | $parameter //= ''; | ||||||||||||||||||
|
Condition50%1/2
$parameter //= ""
MC/DC0%0/1
$parameter //= ""
$parameter
Truth table50%1/2
A
A= $parameter
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 17 | my @parameter = split /\s+with\s+/, $parameter; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 17 | my $self = $proto->SUPER::new( $parameter[0], %kwargs ); | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 17 | ▶ | if( scalar @parameter > 1 ) # with used | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 20 | { | ||||||||||||||||||||
| 21 | 1 | $kwargs{'raw_chunks'} = []; | |||||||||||||||||||
| 22 | 1 | require DTL::Fast::Tag::With; | |||||||||||||||||||
| 23 | 1 | $self = DTL::Fast::Tag::With->new($parameter[1], %kwargs)->add_chunk($self); | |||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | 17 | return $self; | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | #@Override | ||||||||||||||||||||
| 30 | sub parse_parameters | ||||||||||||||||||||
| 31 | { | ||||||||||||||||||||
| 32 | 17 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
parse_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 33 | 17 | $self->{'template'} = DTL::Fast::Expression->new($self->{'parameter'}); | |||||||||||||||||||
| 34 | 17 | return $self; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | #@Override | ||||||||||||||||||||
| 38 | sub render | ||||||||||||||||||||
| 39 | { | ||||||||||||||||||||
| 40 | 21 | ▶ | my ($self, $context) = @_; | ||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 21 | my $template_name = $self->{'template'}->render($context); | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | my $result = DTL::Fast::get_template( | ||||||||||||||||||||
| 45 | $template_name | ||||||||||||||||||||
| 46 | 21 | , 'dirs' => $self->{'dirs'} | |||||||||||||||||||
| 47 | ); | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | die $self->get_render_error( | ||||||||||||||||||||
| 50 | $context, | ||||||||||||||||||||
| 51 | sprintf( | ||||||||||||||||||||
| 52 | "Couldn't find included template %s in directories %s" | ||||||||||||||||||||
| 53 | , $template_name // 'undef' | ||||||||||||||||||||
| 54 | 20 | ▶ | , join(', ', @{$self->{'dirs'}}) | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$template_name // "undef"
MC/DC0%0/1
$template_name // "undef"
$template_name
Truth table0%0/2
A
A= $template_name
| |||||||||||||||||||||
| 55 | ) | ||||||||||||||||||||
| 56 | ) if not defined $result; | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 20 | return $result->render($context); | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 5 | 1; | |||||||||||||||||||