line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gruntmaster::Opener; |
2
|
2
|
|
|
2
|
|
22364
|
use 5.014; |
|
2
|
|
|
|
|
6
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
692
|
use parent qw/Exporter/; |
|
2
|
|
|
|
|
310
|
|
|
2
|
|
|
|
|
12
|
|
6
|
2
|
|
|
2
|
|
105
|
use re '/s'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
233
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw/handle_line/; |
9
|
|
|
|
|
|
|
our @EXPORT_OK = @EXPORT; |
10
|
|
|
|
|
|
|
our $VERSION = '5999.000_015'; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
1551
|
use Date::Parse qw/str2time/; |
|
2
|
|
|
|
|
15449
|
|
|
2
|
|
|
|
|
142
|
|
13
|
2
|
|
|
2
|
|
546
|
use Gruntmaster::Data; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
773
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _analyze_request { |
16
|
4
|
|
|
4
|
|
18
|
s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg for @_; # From URI::Escape POD |
|
9
|
|
|
|
|
32
|
|
17
|
4
|
|
|
|
|
7
|
my ($req, $parms) = @_; |
18
|
4
|
50
|
|
|
|
17
|
return unless $parms =~ /contest=(\w+)/; |
19
|
4
|
|
|
|
|
9
|
my $ct = $1; |
20
|
4
|
100
|
|
|
|
27
|
return $req =~ m,/pb/(\w+), ? ($1, $ct) : (); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub handle_line { |
24
|
8
|
100
|
|
8
|
0
|
3900
|
my ($owner, $datetime, $request, $parms) = $_[0] =~ |
25
|
|
|
|
|
|
|
/(\w+)\s # user |
26
|
|
|
|
|
|
|
\[([^]]+)\]\s # date |
27
|
|
|
|
|
|
|
"\w+\s # request method |
28
|
|
|
|
|
|
|
([^" ?]+) # URL (without query string) |
29
|
|
|
|
|
|
|
[?] |
30
|
|
|
|
|
|
|
([^" ]+)\s # query string |
31
|
|
|
|
|
|
|
[^"]+"\s # HTTP version |
32
|
|
|
|
|
|
|
2 # response code starts with 2 |
33
|
|
|
|
|
|
|
/x or return; |
34
|
4
|
100
|
|
|
|
15
|
my ($pb, $ct) = _analyze_request $request, $parms or return; |
35
|
3
|
|
|
|
|
13
|
my $time = str2time $datetime; |
36
|
3
|
|
|
|
|
735
|
open_problem $ct, $pb, $owner, $time; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
__END__ |