This file is indexed.

/usr/share/perl5/CQL/Visitor.pm is in libcql-parser-perl 1.10-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
78
79
80
81
82
83
84
85
package CQL::Visitor;

use strict;
use warnings;

=head1 NAME

CQL::Visitor - visit nodes in a CQL parse tree

=head1 SYNOPSIS

    package MyVisitor;
    use base qw( CQL::Visitor );

    sub term {
        my ($self,$node) = @_;
        # do something to the node
    }

    # later on
   
    my $parser = CQL::Parser->new();
    my $root = $parser->parse($cql);

    my $visitor = MyVisitor->new();
    $vistor->visit($root);

=head1 DESCRIPTION

CQL::Visitor provides a simple interface for visiting nodes in your parse tree.
It could be useful if you want to do something like change a query like this:

    dc.title=foo and dc.creator=bar 

    into

    title=foo and creator=bar

Or some similar procedure. You simply create a new subclass of CQL::Visitor
and override the appropriate method, such as term(). Every term that is
encountered during the traversal will be handed off to your term() method.

Note: at the moment only term() is supported because that's what was needed, but
if you need other ones feel free to add them, or ask for them.

=head1 METHODS

=head2 new()

=cut

sub new {
    my $class = shift;
    return bless {}, ref($class) || $class;
}

=head2 visit()

Call this to traverse your parse tree, starting at the root.

=cut

sub visit {
    my ($self,$node) = @_;
    if ( $node->isa( 'CQL::BooleanNode' ) ) { 
        $self->visit( $node->left() );
        $self->visit( $node->right() );
    }
    elsif ( $node->isa( 'CQL::TermNode' ) ) {
        $self->term( $node );
    }
}

=head2 term()

Your subclass should override this, and do something meaningful with the
CQL::TermNode object.

=cut

sub term {
    # subclasses should subclass
}

1;