line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gruntmaster::Opener; |
2
|
2
|
|
|
2
|
|
30394
|
use 5.014; |
|
2
|
|
|
|
|
9
|
|
3
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1165
|
use parent qw/Exporter/; |
|
2
|
|
|
|
|
664
|
|
|
2
|
|
|
|
|
19
|
|
6
|
2
|
|
|
2
|
|
179
|
use re '/s'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
361
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw/handle_line/; |
9
|
|
|
|
|
|
|
our @EXPORT_OK = @EXPORT; |
10
|
|
|
|
|
|
|
our $VERSION = '5999.000_014'; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
2501
|
use Date::Parse qw/str2time/; |
|
2
|
|
|
|
|
15967
|
|
|
2
|
|
|
|
|
178
|
|
13
|
2
|
|
|
2
|
|
629
|
use Gruntmaster::Data; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
815
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _analyze_request { |
16
|
4
|
|
|
4
|
|
19
|
s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg for @_; # From URI::Escape POD |
|
9
|
|
|
|
|
29
|
|
17
|
4
|
|
|
|
|
8
|
my ($req, $parms) = @_; |
18
|
4
|
50
|
|
|
|
17
|
return unless $parms =~ /contest=(\w+)/; |
19
|
4
|
|
|
|
|
11
|
my $ct = $1; |
20
|
4
|
100
|
|
|
|
28
|
return $req =~ m,/pb/(\w+), ? ($1, $ct) : (); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub handle_line { |
24
|
8
|
100
|
|
8
|
0
|
3791
|
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
|
|
|
|
13
|
my ($pb, $ct) = _analyze_request $request, $parms or return; |
35
|
3
|
|
|
|
|
13
|
my $time = str2time $datetime; |
36
|
3
|
|
|
|
|
761
|
open_problem $ct, $pb, $owner, $time; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
__END__ |