This file is indexed.

/usr/share/perl5/Tree/XPathEngine/LocationPath.pm is in libtree-xpathengine-perl 0.05-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# $Id: /tree-xpathengine/trunk/lib/Tree/XPathEngine/LocationPath.pm 22 2006-02-13T14:00:25.731780Z mrodrigu  $

package Tree::XPathEngine::LocationPath;
use strict;

sub new {
	my $class = shift;
	my $self = [];
	bless $self, $class;
}

sub as_string {
	my $self = shift;
	my $string;
	for (my $i = 0; $i < @$self; $i++) {
		$string .= $self->[$i]->as_string;
		$string .= "/" if $self->[$i+1];
	}
	return $string;
}

sub as_xml {
    my $self = shift;
    my $string = "<LocationPath>\n";

    for (my $i = 0; $i < @$self; $i++) {
        $string .= $self->[$i]->as_xml;
    }

    $string .= "</LocationPath>\n";
    return $string;
}


sub evaluate {
	my $self = shift;
	# context _MUST_ be a single node
	my $context = shift;
	die "No context" unless $context;
	
	# I _think_ this is how it should work :)
	
	my $nodeset = Tree::XPathEngine::NodeSet->new();
	$nodeset->push($context);
	
	foreach my $step (@$self) {
		# For each step
		# evaluate the step with the nodeset
		my $pos = 1;
		$nodeset = $step->evaluate($nodeset);
	}
	
	return $nodeset->remove_duplicates;
}

1;

__END__
=head1 NAME Tree::XPathEngine::LocationPath - a complete XPath location path

=head1 METHODS

=head2 new 

creates the location path

=head2 evaluate

evaluates it in C<$context>

=head2 as_string 

dumps the location path as a string

=head2 as_xml

dumps the location path as xml