line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nginx::Runner::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
578
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
164
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub encode { |
7
|
4
|
|
|
4
|
0
|
2198
|
my $config_data = shift; |
8
|
4
|
|
100
|
|
|
11
|
my $indent = shift || 0; |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
|
|
5
|
my $indent_symbols = ''; |
11
|
4
|
|
|
|
|
6
|
$indent_symbols .= ' ' for (1 .. $indent); |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
|
|
3
|
my $config = ''; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
5
|
foreach my $token (@$config_data) { |
16
|
6
|
|
|
|
|
5
|
my $name = shift @$token; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
7
|
my $token_string = $indent_symbols . $name; |
19
|
6
|
|
|
|
|
6
|
my $token_string_suffix = ";\n"; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
5
|
foreach my $item (@$token) { |
22
|
7
|
100
|
|
|
|
9
|
unless (ref $item) { |
23
|
5
|
|
|
|
|
7
|
$token_string .= " $item"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
2
|
|
|
|
|
5
|
$token_string = "\n$token_string {\n"; |
27
|
2
|
|
|
|
|
7
|
$token_string .= encode($item, $indent + 1); |
28
|
2
|
|
|
|
|
4
|
$token_string .= $indent_symbols . "}\n"; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
3
|
$token_string_suffix = ''; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
6
|
|
|
|
|
8
|
$config .= $token_string . $token_string_suffix; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
13
|
$config; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |