blib/lib/XML/XPath/Root.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 37 CC 2 SCAR 10.6
CC
2
Cov
0%
evaluate
6.0
new
2.0
as_string
2.0
CRAP 2.9
1 package XML::XPath::Root;
2  
3 $VERSION = '1.49';
4  
5 use strict; use warnings;
6 use XML::XPath::XMLParser;
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;