Rev | Line | |
---|
[1] | 1 | #!/usr/bin/perl -w |
---|
| 2 | use strict; |
---|
| 3 | |
---|
| 4 | package MyVisitor; |
---|
| 5 | use base qw( CQL::Visitor ); |
---|
| 6 | |
---|
| 7 | sub term { |
---|
| 8 | my ($self,$node) = @_; |
---|
| 9 | # do something to the node |
---|
| 10 | print $node->{qualifier}, " ", $node->{term}, "\n"; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | package main; |
---|
| 14 | |
---|
| 15 | use CQL::Parser; |
---|
| 16 | use YAML; |
---|
| 17 | |
---|
| 18 | my $p = CQL::Parser->new; |
---|
| 19 | |
---|
| 20 | my $cql = <<END; |
---|
| 21 | artist = (ilyaimy or rob) and title = angel |
---|
| 22 | END |
---|
| 23 | |
---|
| 24 | my $root = $p->parse($cql); |
---|
| 25 | |
---|
| 26 | #print Dump($root); |
---|
| 27 | |
---|
| 28 | my $visitor = MyVisitor->new; |
---|
| 29 | $visitor->visit($root); |
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.