line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::HTML::Content::XPathExtensions; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
4
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
389
|
use HTML::TokeParser; |
|
1
|
|
|
|
|
8831
|
|
|
1
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# we want to stay compatible to 5.5 and use warnings if |
9
|
|
|
|
|
|
|
# we can |
10
|
1
|
|
|
1
|
|
5
|
eval 'use warnings;' if ($] >= 5.006); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
7
|
use vars qw( $HTML_PARSER_StripsTags $VERSION @exports ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
203
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '0.11'; |
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
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
41
|
|
|
|
|
|
|
# Install our extensions unless they already exist : |
42
|
2
|
|
|
|
|
24
|
*{"XML::XPath::Function::$_"} = *{"Test::HTML::Content::XPathExtensions::$_"} |
|
2
|
|
|
|
|
5
|
|
43
|
2
|
50
|
|
|
|
3
|
unless defined *{"XML::XPath::Function::$_"}{CODE}; |
|
2
|
|
|
|
|
13
|
|
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |