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