blib/lib/XML/XPath/Helper/Const.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package XML::XPath::Helper::Const;
2
3 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8
9 2 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 2 our $VERSION = '0.03';
12
13 2 our @EXPORT_OK = qw(XPATH_SIMPLE_LIST
14 XPATH_SIMPLE_TAGS
15 XPATH_NESTED_TAGS);
16
17 2 our %EXPORT_TAGS = (all => \@EXPORT_OK);
18
19 use constant
20 {
21 # The following is taken from:
22 # https://stackoverflow.com/questions/75059177/is-it-possible-to-find-nodes-containing-a-simple-list-using-xpath-1-0/75061420#75061420
23 2 XPATH_SIMPLE_LIST => XML::LibXML::XPathExpression->new(<<"EOT"),
24 ./*[
25 *[not(*)]
26 and
27 not(*[position()>1
28 and
29 name(.) != name(preceding-sibling::*[1])])
30 ]
31 EOT
32 XPATH_SIMPLE_TAGS => XML::LibXML::XPathExpression->new("*[count(*) = 0]"),
33 XPATH_NESTED_TAGS => XML::LibXML::XPathExpression->new("*[count(*) > 0]"),
34 2 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
35
36
37
38 2 1; # End of XML::XPath::Helper::Const
39
40 __END__
↑ Summary