line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Proxy::BodyFilter::htmlparser; |
2
|
|
|
|
|
|
|
$HTTP::Proxy::BodyFilter::htmlparser::VERSION = '0.303'; |
3
|
2
|
|
|
2
|
|
1503
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
37
|
|
|
2
|
|
|
|
|
117
|
|
5
|
2
|
|
|
2
|
|
410
|
use HTTP::Proxy::BodyFilter; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
6
|
2
|
|
|
2
|
|
9
|
use vars qw( @ISA ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
382
|
|
7
|
|
|
|
|
|
|
@ISA = qw( HTTP::Proxy::BodyFilter ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
3
|
100
|
|
3
|
1
|
170
|
croak "First parameter must be a HTML::Parser object" |
11
|
|
|
|
|
|
|
unless $_[1]->isa('HTML::Parser'); |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
2
|
my $self = shift; |
14
|
2
|
|
|
|
|
6
|
$self->{_parser} = shift; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
3
|
my %args = (@_); |
17
|
2
|
|
|
|
|
5
|
$self->{rw} = delete $args{rw}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub filter { |
21
|
2
|
|
|
2
|
1
|
8
|
my ( $self, $dataref, $message, $protocol, $buffer ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
4
|
@{ $self->{_parser} }{qw( output message protocol )} = |
|
2
|
|
|
|
|
6
|
|
24
|
|
|
|
|
|
|
( "", $message, $protocol ); |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
13
|
$self->{_parser}->parse($$dataref); |
27
|
2
|
50
|
|
|
|
58
|
$self->{_parser}->eof if not defined $buffer; # last chunk |
28
|
2
|
100
|
|
|
|
5
|
$$dataref = $self->{_parser}{output} if $self->{rw}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
sub will_modify { $_[0]->{rw} } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |