| 1 | package Nginx::Runner::Config; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | sub encode { | ||||||||||||
| 7 | 4 | ▶ | my $config_data = shift; | ||||||||||
|
Subroutine
encode: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 8 | 4 | ▶ | my $indent = shift || 0; | ||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | my $indent_symbols = ''; | |||||||||||
| 11 | 4 | $indent_symbols .= ' ' for (1 .. $indent); | |||||||||||
| 12 | |||||||||||||
| 13 | 4 | my $config = ''; | |||||||||||
| 14 | |||||||||||||
| 15 | 4 | foreach my $token (@$config_data) { | |||||||||||
| 16 | 6 | my $name = shift @$token; | |||||||||||
| 17 | |||||||||||||
| 18 | 6 | my $token_string = $indent_symbols . $name; | |||||||||||
| 19 | 6 | my $token_string_suffix = ";\n"; | |||||||||||
| 20 | |||||||||||||
| 21 | 6 | foreach my $item (@$token) { | |||||||||||
| 22 | 7 | ▶ | unless (ref $item) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 5 | $token_string .= " $item"; | |||||||||||
| 24 | } | ||||||||||||
| 25 | else { | ||||||||||||
| 26 | 2 | $token_string = "\n$token_string {\n"; | |||||||||||
| 27 | 2 | $token_string .= encode($item, $indent + 1); | |||||||||||
| 28 | 2 | $token_string .= $indent_symbols . "}\n"; | |||||||||||
| 29 | |||||||||||||
| 30 | 2 | $token_string_suffix = ''; | |||||||||||
| 31 | } | ||||||||||||
| 32 | } | ||||||||||||
| 33 | |||||||||||||
| 34 | 6 | $config .= $token_string . $token_string_suffix; | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 4 | $config; | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 1 | 1; | |||||||||||