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