line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Opentracker::Stats::Mode::Renew; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27530
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
|
|
6
|
use parent qw/ |
7
|
|
|
|
|
|
|
WWW::Opentracker::Stats::Mode |
8
|
|
|
|
|
|
|
Class::Accessor::Fast |
9
|
1
|
|
|
1
|
|
1610
|
/; |
|
1
|
|
|
|
|
339
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->_format('txt'); |
13
|
|
|
|
|
|
|
__PACKAGE__->_mode('renew'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/_stats/); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
WWW::Opentracker::Stats::Mode::Renew |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Parses the renew statistics from opentracker. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 parse_stats |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Args: $self, $payload |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Decodes the plain text data retrieved from the renew statistics of |
33
|
|
|
|
|
|
|
opentracker. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The payload looks like this (no indentation): |
36
|
|
|
|
|
|
|
00 51 |
37
|
|
|
|
|
|
|
01 79 |
38
|
|
|
|
|
|
|
02 69 |
39
|
|
|
|
|
|
|
03 80 |
40
|
|
|
|
|
|
|
... |
41
|
|
|
|
|
|
|
41 0 |
42
|
|
|
|
|
|
|
42 1 |
43
|
|
|
|
|
|
|
43 2 |
44
|
|
|
|
|
|
|
44 3 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub parse_stats { |
49
|
1
|
|
|
1
|
1
|
2
|
my ($self, $payload) = @_; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
2
|
my %stats = (); |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
5
|
for my $line (split "\n", $payload) { |
54
|
8
|
|
|
|
|
10
|
chomp $line; |
55
|
|
|
|
|
|
|
|
56
|
8
|
50
|
|
|
|
34
|
my ($idx, $count) = $line =~ m{^(\d+) (\d+)} |
57
|
|
|
|
|
|
|
or die "Unable to parse line: $line"; |
58
|
|
|
|
|
|
|
|
59
|
8
|
|
|
|
|
19
|
$stats{$idx} = $count; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
14
|
return \%stats; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Knut-Olav Hoven, Eknutolav@gmail.comE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Copyright (C) 2009 by Knut-Olav Hoven |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
79
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
80
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|