|
NAMEText::Query - Query processing framework SYNOPSIS use Text::Query;
# Constructor
$query = Text::Query->new([QSTRING] [OPTIONS]);
# Methods
$query->prepare(QSTRING [OPTIONS]);
$query->match([TARGET]);
$query->matchscalar([TARGET]);
DESCRIPTIONThis module provides an object that matches a data source against a query expression. Query expressions are compiled into an internal form when a new object is created or the "prepare" method is called; they are not recompiled on each match. The class provided by this module uses four packages to process the query. The query parser parses the question and calls a query expression builder (internal form of the question). The optimizer is then called to reduce the complexity of the expression. The solver applies the expression on a data source. The following parsers are provided: The following builders are provided: The following solver is provided: EXAMPLES use Text::Query;
my $q=new Text::Query('hello and world',
-parse => 'Text::Query::ParseAdvanced',
-solve => 'Text::Query::SolveAdvancedString',
-build => 'Text::Query::BuildAdvancedString');
die "bad query expression" if not defined $q;
print if $q->match;
...
$q->prepare('goodbye or adios or ta ta',
-litspace => 1,
-case => 1);
#requires single space between the two ta's
if($q->match($line)) {
#doesn't match "Goodbye"
...
$q->prepare('"and" or "or"');
#quoting operators for literal match
...
$q->prepare('\\bintegrate\\b', -regexp => 1);
#won't match "disintegrated"
CONSTRUCTOR
METHODS
SEE ALSOText::Query::ParseAdvanced(3), Text::Query::ParseSimple(3), Text::Query::BuildSimpleString(3), Text::Query::BuildAdvanedString(3), Text::Query::SolveSimpleString(3), Text::Query::SolveAdvancedString(3), Text::Query::Build(3), Text::Query::Parse(3), Text::Query::Solve(3), Text::Query::Optimize(3) MAINTENANCEAUTHORSEric Bohlman (ebohlman@netcom.com) Loic Dachary (loic@senga.org) Jon Jensen, jon@endpoint.com
|