| 1 | package DTL::Fast::Tag::Cycle; | ||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | 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 | 2 | ▶ | use parent 'DTL::Fast::Tag::Simple'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 2 | $DTL::Fast::TAG_HANDLERS{'cycle'} = __PACKAGE__; | |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | #@Override | ||||||||||||||||||||||||||||||||
| 8 | sub parse_parameters | ||||||||||||||||||||||||||||||||
| 9 | { | ||||||||||||||||||||||||||||||||
| 10 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
parse_parameters: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 11 | $self->{'parameter'} =~ /^\s*(.+?)\s*(?:as (.+?)\s*(silent)?)?\s*$/; | |||||||||||||||||||||||||||||||
| 13 | 11 | ▶ | @{$self}{'source', 'destination', 'silent', 'sources', 'current_sources'} = ($1 // '', $2 // '', $3 // '', [], []); | ||||||||||||||||||||||||||||||
|
Condition50%3/6
$1 // ""
$2 // ""
$3 // ""
MC/DC0%0/1
$1 // ""
$1
MC/DC0%0/1
$2 // ""
$2
MC/DC0%0/1
$3 // ""
$3
Truth table50%1/2
A
A= $1
Truth table50%1/2
A
A= $2
Truth table50%1/2
A
A= $3
| |||||||||||||||||||||||||||||||||
| 14 | 11 | $self->{'sources'} = $self->parse_sources($self->{'source'}); | |||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 11 | return $self; | |||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | #@Override | ||||||||||||||||||||||||||||||||
| 20 | sub render | ||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||
| 22 | 53 | ▶ | my( $self, $context, $global_safe) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 23 | 53 | my $result = ''; | |||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | 53 | my $source = $self->get_next_source(); | |||||||||||||||||||||||||||||||
| 26 | 53 | my $current_value = $source->render($context, $global_safe); | |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 53 | ▶ | if( not $self->{'silent'} ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||||
| 30 | 43 | $result = $current_value; | |||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 53 | ▶ | if( $self->{'destination'} ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||
| 35 | 20 | $context->set( $self->{'destination'} => $current_value ); | |||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | 53 | return $result; | |||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | sub get_next_source | ||||||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||||||
| 43 | 53 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_next_source: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 53 | ▶ | if( not scalar @{$self->{'current_sources'}} ) # populate for current cycle | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||||||
| 47 | 18 | push @{$self->{'current_sources'}}, @{$self->{'sources'}}; | |||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 53 | return shift @{$self->{'current_sources'}}; | |||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 2 | 1; | |||||||||||||||||||||||||||||||