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