line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::HTML::Content::XPathExtensions; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
484
|
use HTML::TokeParser; |
|
1
|
|
|
|
|
10276
|
|
|
1
|
|
|
|
|
50
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# we want to stay compatible to 5.5 and use warnings if |
9
|
|
|
|
|
|
|
# we can |
10
|
1
|
|
|
1
|
|
7
|
eval 'use warnings;' if ($] >= 5.006); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
11
|
1
|
|
|
1
|
|
8
|
use vars qw( $HTML_PARSER_StripsTags $VERSION @exports ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
252
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '0.12'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@exports = qw( matches comment ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub matches { |
18
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
19
|
0
|
|
|
|
|
0
|
my ($node, @params) = @_; |
20
|
0
|
0
|
|
|
|
0
|
die "starts-with: incorrect number of params\n" unless @params == 2; |
21
|
0
|
|
|
|
|
0
|
my $re = $params[1]->string_value; |
22
|
0
|
0
|
|
|
|
0
|
return($params[0]->string_value =~ /$re/) |
23
|
|
|
|
|
|
|
? XML::XPath::Boolean->True |
24
|
|
|
|
|
|
|
: XML::XPath::Boolean->False; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub comment { |
28
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
29
|
0
|
|
|
|
|
0
|
my ($node, @params) = @_; |
30
|
0
|
0
|
|
|
|
0
|
die "starts-with: incorrect number of params\n" unless @params == 1; |
31
|
0
|
|
|
|
|
0
|
my $re = $params[1]->string_value; |
32
|
0
|
0
|
|
|
|
0
|
return(ref $node =~ /Comment$/) |
33
|
|
|
|
|
|
|
? XML::XPath::Boolean->True |
34
|
|
|
|
|
|
|
: XML::XPath::Boolean->False; |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub import { |
39
|
1
|
|
|
1
|
|
3
|
for (@exports) { |
40
|
1
|
|
|
1
|
|
9
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
136
|
|
41
|
|
|
|
|
|
|
# Install our extensions unless they already exist : |
42
|
2
|
|
|
|
|
29
|
*{"XML::XPath::Function::$_"} = *{"Test::HTML::Content::XPathExtensions::$_"} |
|
2
|
|
|
|
|
6
|
|
43
|
2
|
50
|
|
|
|
3
|
unless defined *{"XML::XPath::Function::$_"}{CODE}; |
|
2
|
|
|
|
|
17
|
|
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |