CQL::Visitor(3pm)
π CQL::Visitor β the manual, but make it cute π
okay bestie, welcome to CQL::Visitor(3pm), a Perl module from the User Contributed Perl Documentation crew β¨ this one is literally about walking around inside a CQL parse tree and saying hi to the nodes. no cap.
πΈ NAME πΈ
CQL::Visitor β visit nodes in a CQL parse tree π¦
β¨ SYNOPSIS β¨
here's the vibe, copy it exactly okay:
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);
(yes the $vistor typo is in the original, i am NOT touching it, i'm just the messenger π)
π DESCRIPTION π
so, CQL::Visitor gives you a super simple interface for visiting the nodes in your parse tree. it's giving "i just want to poke around in here" energy. π«Ά
it could be useful if you wanna do something like turn a query that looks like this:
dc.title=foo and dc.creator=bar
into:
title=foo and creator=bar
or literally any similar procedure, you do you. π
the way this works: you just create a new subclass of CQL::Visitor and override the appropriate method β like term(), for example. every single term that gets encountered during the traversal will be handed off to your term() method. slay. β¨
note bestie: 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. iconic behavior honestly.
π METHODS π
π new()
the constructor, she's here, she's ready, she makes you a new visitor. π§
π visit()
call this one to traverse your parse tree, starting right at the root. main character energy fr fr. π
π term()
your subclass should override this, and do something meaningful with the CQL::TermNode object. that's the whole assignment bestie. π₯
and that's the whole page, no notes π this was perl v5.36.0, dated 2022-12-11 β shoutout to the original CQL::Visitor(3pm) footer, mwah, periodt. π
β¨
π¦ where this page comes from
- debian bookworm: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcql-parser-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms