line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::DaemontoolsStatus; |
2
|
2
|
|
|
2
|
|
51773
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
862
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub parse { |
7
|
7
|
|
|
7
|
0
|
13849
|
my $line = shift; |
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
|
|
12
|
my ($service, $status, $pid, $seconds, $info); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# parse up status line |
12
|
7
|
|
|
|
|
42
|
$line =~ / |
13
|
|
|
|
|
|
|
^ |
14
|
|
|
|
|
|
|
(\S+):\s # $1 service |
15
|
|
|
|
|
|
|
(\S+)\s # $2 status |
16
|
|
|
|
|
|
|
\(pid\s(\S+)\)\s # $3 pid |
17
|
|
|
|
|
|
|
(\S+)\s seconds # $4 seconds |
18
|
|
|
|
|
|
|
(,?\s?.*) # $5 info |
19
|
|
|
|
|
|
|
$ |
20
|
|
|
|
|
|
|
/x; |
21
|
|
|
|
|
|
|
|
22
|
7
|
|
|
|
|
37
|
($service, $status, $pid, $seconds, $info) = ($1,$2,$3,$4,$5); |
23
|
7
|
100
|
|
|
|
27
|
$info =~ s/^,\s// if $info; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return +{ |
26
|
7
|
100
|
|
|
|
46
|
service => $service, |
27
|
|
|
|
|
|
|
status => $status, |
28
|
|
|
|
|
|
|
pid => $pid, |
29
|
|
|
|
|
|
|
seconds => $seconds, |
30
|
|
|
|
|
|
|
info => $info, |
31
|
|
|
|
|
|
|
} if $service; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# parse down status line |
34
|
3
|
|
|
|
|
13
|
$line =~ / |
35
|
|
|
|
|
|
|
^ |
36
|
|
|
|
|
|
|
(\S+):\s # $1 service |
37
|
|
|
|
|
|
|
(\S+)\s # $2 status |
38
|
|
|
|
|
|
|
(\S+)\s seconds # $3 seconds |
39
|
|
|
|
|
|
|
(,?\s?.*) # $4 info |
40
|
|
|
|
|
|
|
$ |
41
|
|
|
|
|
|
|
/x; |
42
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
11
|
($service, $status, $pid, $seconds, $info) = ($1,$2,undef,$3,$4); |
44
|
3
|
100
|
|
|
|
17
|
$info =~ s/^,\s// if $info; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return +{ |
47
|
3
|
100
|
|
|
|
24
|
service => $service, |
48
|
|
|
|
|
|
|
status => $status, |
49
|
|
|
|
|
|
|
pid => $pid, |
50
|
|
|
|
|
|
|
seconds => $seconds, |
51
|
|
|
|
|
|
|
info => $info, |
52
|
|
|
|
|
|
|
} if $service; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# parse not running status line |
55
|
1
|
|
|
|
|
8
|
$line =~ / |
56
|
|
|
|
|
|
|
^ |
57
|
|
|
|
|
|
|
(\S+):\s # $1 service |
58
|
|
|
|
|
|
|
(supervise\snot\srunning) # $2 status |
59
|
|
|
|
|
|
|
$ |
60
|
|
|
|
|
|
|
/x; |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
6
|
($service, $status, $pid, $seconds, $info) = ($1,$2,undef,0,''); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return +{ |
65
|
1
|
50
|
|
|
|
11
|
service => $service, |
66
|
|
|
|
|
|
|
status => $status, |
67
|
|
|
|
|
|
|
pid => $pid, |
68
|
|
|
|
|
|
|
seconds => $seconds, |
69
|
|
|
|
|
|
|
info => $info, |
70
|
|
|
|
|
|
|
} if $service; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |