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