line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Polipo; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
30705
|
use 5.008009; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
34
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1509
|
use IO::File; |
|
1
|
|
|
|
|
21098
|
|
|
1
|
|
|
|
|
868
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use Data::Polipo ':all'; |
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
19
|
|
|
|
|
|
|
# will save memory. |
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
) ] ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Preloaded methods go here. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $count = 0; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
1
|
|
|
1
|
1
|
13
|
my ($class, $file) = @_; |
39
|
1
|
|
|
|
|
3
|
my $h = {}; |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
10
|
my $fh = new IO::File $file, "r" or die "$file: $!"; |
42
|
1
|
|
|
|
|
123
|
$fh->binmode; |
43
|
1
|
|
|
|
|
10
|
local $/ = "\r\n"; |
44
|
1
|
|
|
|
|
29
|
my $res = <$fh>; |
45
|
1
|
|
|
|
|
3
|
chomp $res; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
4
|
my $ns = $class . "::" . $count ++; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
5
|
while (my $line = <$fh>) { |
50
|
15
|
|
|
|
|
16
|
chomp $line; |
51
|
15
|
100
|
|
|
|
36
|
last if ($line =~ /^$/); |
52
|
|
|
|
|
|
|
|
53
|
14
|
|
|
|
|
56
|
my ($k, $v) = $line =~ /([^:]+):\s*(.*)/; |
54
|
14
|
50
|
0
|
|
|
605
|
warn $line and next unless ($k); |
55
|
14
|
|
|
|
|
30
|
$k =~ s/-/_/g; |
56
|
14
|
|
|
|
|
58
|
$k =~ s/^(.+)$/\L$1\E/; |
57
|
14
|
100
|
|
|
|
37
|
if (! defined $h->{$k}) { |
58
|
12
|
|
|
|
|
22
|
$h->{$k} = $v; |
59
|
1
|
|
|
1
|
|
10
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1016
|
|
60
|
12
|
|
|
5
|
|
48
|
*{$ns . "::" . $k} = (sub {my $v=shift; sub {$v}})->($v); |
|
12
|
|
|
|
|
88
|
|
|
12
|
|
|
|
|
19
|
|
|
12
|
|
|
|
|
30
|
|
|
5
|
|
|
|
|
18
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
1
|
50
|
|
|
|
5
|
if (my $offset = $h->{x_polipo_body_offset}) { |
65
|
1
|
|
|
|
|
10
|
$fh->seek ($offset, SEEK_SET); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
16
|
my $d = bless {} => $ns; |
69
|
1
|
100
|
|
7
|
|
4
|
my $obj = sub {wantarray ? ($fh, $res) : $d}; |
|
7
|
|
|
|
|
32
|
|
70
|
1
|
|
|
|
|
7
|
bless $obj => $class; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub open { |
74
|
1
|
|
|
1
|
1
|
4
|
return ($_[0]->())[0]; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub status { |
78
|
1
|
|
|
1
|
1
|
11
|
return ($_[0]->())[1]; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub header { |
82
|
5
|
|
|
5
|
0
|
383
|
return $_[0]->(); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |