File Coverage

blib/lib/Tree/XPathEngine/Root.pm
Criterion Covered Total %
statement 15 17 88.2
branch 1 2 50.0
condition n/a
subroutine 4 6 66.6
pod 4 4 100.0
total 24 29 82.7


line stmt bran cond sub pod time code
1             # $Id: /tree-xpathengine/trunk/lib/Tree/XPathEngine/Root.pm 17 2006-02-12T08:00:01.814064Z mrodrigu $
2              
3             package Tree::XPathEngine::Root;
4 5     5   25 use strict;
  5         11  
  5         236  
5 5     5   27 use Tree::XPathEngine::NodeSet;
  5         11  
  5         966  
6              
7             sub new {
8 87     87 1 155 my $class = shift;
9 87         118 my $self; # actually don't need anything here - just a placeholder
10 87         460 bless \$self, $class;
11             }
12              
13 0     0 1 0 sub as_string {
14             # do nothing
15             }
16              
17             sub as_xml {
18 0     0 1 0 return "\n";
19             }
20              
21             sub evaluate {
22 105     105 1 141 my $self = shift;
23 105         137 my $nodeset = shift;
24            
25             # warn "Eval ROOT\n";
26            
27             # must only ever occur on 1 node
28 105 50       665 die "Can't go to root on > 1 node!" unless $nodeset->size == 1;
29            
30 105         369 my $newset = Tree::XPathEngine::NodeSet->new();
31 105         403 $newset->push($nodeset->get_node(1)->xpath_get_root_node());
32 105         463 return $newset;
33             }
34              
35             1;
36             __END__