File: //usr/local/ssl/local/share/man/man3/Text::Query.3
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Text::Query 3"
.TH Text::Query 3 "1999-06-23" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
Text::Query \- Query processing framework
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Text::Query;
.Ve
.PP
.Vb 2
\& # Constructor
\& $query = Text::Query->new([QSTRING] [OPTIONS]);
.Ve
.PP
.Vb 4
\& # Methods
\& $query->prepare(QSTRING [OPTIONS]);
\& $query->match([TARGET]);
\& $query->matchscalar([TARGET]);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides an object that matches a data source
against a query expression.
.PP
Query expressions are compiled into an internal form when a new object is created
or the \f(CW\*(C`prepare\*(C'\fR method is
called; they are not recompiled on each match.
.PP
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.
.PP
The following parsers are provided:
.IP "Text::Query::ParseAdvanced" 4
.IX Item "Text::Query::ParseAdvanced"
.PD 0
.IP "Text::Query::ParseSimple" 4
.IX Item "Text::Query::ParseSimple"
.PD
.PP
The following builders are provided:
.IP "Text::Query::BuildAdvancedString" 4
.IX Item "Text::Query::BuildAdvancedString"
.PD 0
.IP "Text::Query::BuildSimpleString" 4
.IX Item "Text::Query::BuildSimpleString"
.PD
.PP
The following solver is provided:
.IP "Text::Query::SolveSimpleString" 4
.IX Item "Text::Query::SolveSimpleString"
.PD 0
.IP "Text::Query::SolveAdvancedString" 4
.IX Item "Text::Query::SolveAdvancedString"
.PD
.SH "EXAMPLES"
.IX Header "EXAMPLES"
.Vb 20
\& 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('\e\ebintegrate\e\eb', -regexp => 1);
\& #won't match "disintegrated"
.Ve
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.IP "new ([\s-1QSTRING\s0] [\s-1OPTIONS\s0])" 4
.IX Item "new ([QSTRING] [OPTIONS])"
This is the constructor for a new Text::Query object. If a \f(CW\*(C`QSTRING\*(C'\fR is
given it will be compiled to internal form.
.Sp
\&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs.
Possible options are:
.Sp
\&\fB\-parse\fR \- Package name of the parser. Default is Text::Query::ParseSimple.
.Sp
\&\fB\-build\fR \- Package name of the builder. Default is Text::Query::Build.
.Sp
\&\fB\-optimize\fR \- Package name of the optimizer. Default is Text::Query::Optimize.
.Sp
\&\fB\-solve\fR \- Package name of the solver. Default is Text::Query::Solve.
.Sp
\&\fB\-mode\fR \- Name of predefined group of packages to use. Options are
currently \f(CW\*(C`simple_text\*(C'\fR and \f(CW\*(C`advanced_text\*(C'\fR.
.Sp
These options are handled by the \f(CW\*(C`configure\*(C'\fR method.
.Sp
All other options are passed to the parser \f(CW\*(C`prepare\*(C'\fR function.
See the corresponding manual pages for a description.
.Sp
If \f(CW\*(C`QSTRING\*(C'\fR is undefined, the prepare function is not called.
.Sp
The constructor will croak if a \f(CW\*(C`QSTRING\*(C'\fR was supplied and had
illegal syntax.
.SH "METHODS"
.IX Header "METHODS"
.IP "configure ([\s-1OPTIONS\s0])" 4
.IX Item "configure ([OPTIONS])"
Set the \f(CW\*(C`parse\*(C'\fR, \f(CW\*(C`build\*(C'\fR, \f(CW\*(C`optimize\*(C'\fR or \f(CW\*(C`solve\*(C'\fR packages. See the
\&\f(CW\*(C`CONSTRUCTOR\*(C'\fR description for explanations.
.IP "prepare (\s-1QSTRING\s0 [\s-1OPTIONS\s0])" 4
.IX Item "prepare (QSTRING [OPTIONS])"
Compiles the query expression in \f(CW\*(C`QSTRING\*(C'\fR to internal form and sets any
options (same as in the constructor). \f(CW\*(C`prepare\*(C'\fR may be used to change
the query expression and options for an existing query object. If
\&\f(CW\*(C`OPTIONS\*(C'\fR are omitted, any options set by a previous call to
\&\f(CW\*(C`prepare\*(C'\fR are persistent.
.Sp
The optimizer (\-optimize) is called with the result of the parser (\-parse).
The parser uses the builder (\-build) to construct the internal form.
.Sp
This method returns a reference to the query object if the syntax of the
expression was legal, or croak if not.
.IP "match ([\s-1TARGET\s0])" 4
.IX Item "match ([TARGET])"
Calls the match method of the solver (\-solve).
.IP "matchscalar ([\s-1TARGET\s0])" 4
.IX Item "matchscalar ([TARGET])"
Calls the matchscalar method of the solver (\-solve).
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIText::Query::ParseAdvanced\fR\|(3),
\&\fIText::Query::ParseSimple\fR\|(3),
\&\fIText::Query::BuildSimpleString\fR\|(3),
\&\fIText::Query::BuildAdvanedString\fR\|(3),
\&\fIText::Query::SolveSimpleString\fR\|(3),
\&\fIText::Query::SolveAdvancedString\fR\|(3),
.PP
\&\fIText::Query::Build\fR\|(3),
\&\fIText::Query::Parse\fR\|(3),
\&\fIText::Query::Solve\fR\|(3),
\&\fIText::Query::Optimize\fR\|(3)
.SH "AUTHORS"
.IX Header "AUTHORS"
Eric Bohlman (ebohlman@netcom.com)
.PP
Loic Dachary (loic@senga.org)