line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::Debug::Redis::Info; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Redis info debug panel |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
147263
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
6
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
7
|
1
|
|
|
1
|
|
5
|
use parent qw(Plack::Middleware::Debug::Base Plack::Middleware::Debug::Redis); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
13
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CHIM'; # AUTHORITY |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub prepare_app { |
13
|
1
|
|
|
1
|
1
|
136
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
74
|
$self->redis_connect; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub run { |
19
|
1
|
|
|
1
|
1
|
52555
|
my ($self, $env, $panel) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
6
|
$panel->title('Redis::Info'); |
22
|
1
|
|
|
|
|
8
|
$panel->nav_title($panel->title); |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
39
|
my $info = $self->redis->info; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# tweak db keys |
27
|
1
|
|
|
|
|
107
|
foreach my $db (grep { /^db\d{1,2}/ } keys %$info) { |
|
9
|
|
|
|
|
16
|
|
28
|
2
|
|
|
|
|
9
|
my $flatten = $self->flatten_db($db, $info->{$db}); |
29
|
2
|
|
|
|
|
7
|
my @keys_flatten = keys %$flatten; |
30
|
2
|
|
|
|
|
8
|
@$info{@keys_flatten} = @$flatten{@keys_flatten}; |
31
|
2
|
|
|
|
|
9
|
delete $info->{$db}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
8
|
$panel->nav_subtitle('Version: ' . $info->{redis_version}); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return sub { |
37
|
1
|
|
|
1
|
|
144
|
$panel->content($self->render_hash($info)); |
38
|
1
|
|
|
|
|
11
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub flatten_db { |
42
|
2
|
|
|
2
|
1
|
5
|
my ($self, $database, $value) = @_; |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
3
|
my %flatten = (); |
45
|
|
|
|
|
|
|
|
46
|
4
|
|
|
|
|
94
|
%flatten = map { |
47
|
2
|
|
|
|
|
7
|
my @ary = split /=/; |
48
|
4
|
|
|
|
|
21
|
$database . '_' . $ary[0] => $ary[1]; |
49
|
|
|
|
|
|
|
} split /,/, $value; |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
7
|
\%flatten; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; # End of Plack::Middleware::Debug::Redis::Info |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |