XPath/Root.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« XPath/PerlSAX.pm ↑ Summary XPath/XMLParser.pm »
1 package XML::XPath::Root;
2  
3 $VERSION = '1.26';
4  
5 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XML::XPath::XMLParser;
Subroutine BEGIN: called CC=1 SCAR=2.6
7 use XML::XPath::NodeSet;
8  
9 sub new {
10 my $class = shift;
11 my $self; # actually don't need anything here - just a placeholder
12 bless \$self, $class;
13 }
14  
15 sub as_string {
16 # do nothing
17 }
18  
19 sub as_xml {
20 return "<Root/>\n";
21 }
22  
23 sub evaluate {
24 my $self = shift;
25 my $nodeset = shift;
26  
27 # warn "Eval ROOT\n";
28  
29 # must only ever occur on 1 node
30 die "Can't go to root on > 1 node!" unless $nodeset->size == 1;
31  
32 my $newset = XML::XPath::NodeSet->new();
33 $newset->push($nodeset->get_node(1)->getRootNode());
34 return $newset;
35 }
36  
37 1;
« XPath/PerlSAX.pm ↑ Summary XPath/XMLParser.pm »