line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Parse; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12972
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#ABSTRACT: Deprecated, a wrapper around HTML::TreeBuilder |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
9
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
246
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '5.910'; # 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
|
943
|
my $p = $_[1]; |
27
|
2
|
100
|
|
|
|
10
|
$p = _new_tree_maker() unless $p; |
28
|
2
|
|
|
|
|
31
|
$p->parse( $_[0] ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub parse_htmlfile { |
32
|
3
|
|
|
3
|
1
|
784
|
my ( $file, $p ) = @_; |
33
|
3
|
|
|
|
|
5
|
my ($HTML); |
34
|
3
|
100
|
|
|
|
140
|
open( $HTML, "<", $file ) or return; |
35
|
2
|
100
|
|
|
|
10
|
$p = _new_tree_maker() unless $p; |
36
|
2
|
|
|
|
|
9
|
$p->parse_file($HTML); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _new_tree_maker { |
40
|
2
|
|
|
2
|
|
13
|
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
|
|
|
|
|
23
|
$p->strict_comment(1); |
47
|
2
|
|
|
|
|
4
|
$p; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |