line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Parse; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
46921
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#ABSTRACT: Deprecated, a wrapper around HTML::TreeBuilder |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
9
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '5.07'; # VERSION from OurPkgVersion |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
301
|
use vars qw(@ISA @EXPORT |
14
|
|
|
|
|
|
|
$IMPLICIT_TAGS $IGNORE_UNKNOWN $IGNORE_TEXT $WARN |
15
|
1
|
|
|
1
|
|
5
|
); |
|
1
|
|
|
|
|
1
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
require Exporter; |
18
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
19
|
|
|
|
|
|
|
@EXPORT = qw(parse_html parse_htmlfile); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Backwards compatability |
22
|
|
|
|
|
|
|
$IMPLICIT_TAGS = 1; |
23
|
|
|
|
|
|
|
$IGNORE_UNKNOWN = 1; |
24
|
|
|
|
|
|
|
$IGNORE_TEXT = 0; |
25
|
|
|
|
|
|
|
$WARN = 0; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
require HTML::TreeBuilder; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse_html { |
30
|
2
|
|
|
2
|
1
|
1191
|
my $p = $_[1]; |
31
|
2
|
100
|
|
|
|
7
|
$p = _new_tree_maker() unless $p; |
32
|
2
|
|
|
|
|
20
|
$p->parse( $_[0] ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub parse_htmlfile { |
36
|
3
|
|
|
3
|
1
|
843
|
my ( $file, $p ) = @_; |
37
|
3
|
|
|
|
|
6
|
my ($HTML); |
38
|
3
|
100
|
|
|
|
176
|
open( $HTML, "<", $file ) or return; |
39
|
2
|
100
|
|
|
|
9
|
$p = _new_tree_maker() unless $p; |
40
|
2
|
|
|
|
|
13
|
$p->parse_file($HTML); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _new_tree_maker { |
44
|
2
|
|
|
2
|
|
21
|
my $p = HTML::TreeBuilder->new( |
45
|
|
|
|
|
|
|
implicit_tags => $IMPLICIT_TAGS, |
46
|
|
|
|
|
|
|
ignore_unknown => $IGNORE_UNKNOWN, |
47
|
|
|
|
|
|
|
ignore_text => $IGNORE_TEXT, |
48
|
|
|
|
|
|
|
'warn' => $WARN, |
49
|
|
|
|
|
|
|
); |
50
|
2
|
|
|
|
|
12
|
$p->strict_comment(1); |
51
|
2
|
|
|
|
|
4
|
$p; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |