Taxi::Mysql::MacroUtils - extendable full-text index using mysql: macro expansion utilities


NAME

Taxi::Mysql::MacroUtils - extendable full-text index using mysql: macro expansion utilities

(Back to Top)


SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 use Taxi::Mysql::MacroUtils;
 ##========================================================================
 ## Inheritance
 $generator = $CLASS_OR_OBJ->new(%args);
 undef      = $CLASS_OR_OBJ->DESTROY();
 ##========================================================================
 ## API: Calling objects
 undef = newSymbolGenerator($generator);
 undef = freeSymbolGenerator($generator);
 ##========================================================================
 ## Utils: Symbol Generation
 $sym = macro_gensym();
 ##========================================================================
 ## Utils: Macro expansion
 $thingy_expanded = macro_expand($thingy, {$from=>$to, ...});

(Back to Top)


DESCRIPTION

Taxi::Mysql::MacroUtils provides symbol generation and macro expansion utitilities for Taxi::Mysql. It is used by Taxi::Mysql::Query::Base and Taxi::Mysql::Query::Parser.

Globals

Variable: %_symbol_i

Variable counter for 'macro_gensym()': ($prefix=>$ctr, ...)

Variable: %_symbol_generators

Pseudo-set of extant symbol generators. see newSymbolGenerator(), freeSymbolGenerator().

Variable: %EXPORT_TAGS

Taxi::Mysql::MacroUtils exports the following tagged sets:

:generate

newSymbolGenerator(), freeSymbolGenerator(), macro_gensym()

:expand

macro_expand()

Inheritance

new
 $generator = $CLASS_OR_OBJ->new(%args);

If you inherit from MacroUtils, calling the inerhited new() method will register your object $obj as a symbol generator.

DESTROY
 undef = $CLASS_OR_OBJ->DESTROY();

... and the inheritd DESTROY() method will unregister it.

API: Calling objects

newSymbolGenerator
 undef = newSymbolGenerator($generator);
 undef = $generator->newSymbolGenerator()

Register a symbol generator (any $generator that might call macroGensym())

freeSymbolGenerator
 undef = freeSymbolGenerator($generator);

Unregister a registered symbol generator.

Utils: Symbol Generation

macro_gensym
 $sym = macro_gensym();
 $sym = macro_gensym($symbol_prefix)

Generates a new symbol $sym with optional prefix $symbol_prefix. Note that the 'symbols' generated just plain perl strings, and have nothing to do with e.g. perl's Gensym module.

$var_prefix defaults to '__symbol__'

Utils: Macro expansion

macro_expand
 $thingy_expanded = macro_expand($thingy, \%macros);

Performs only a single pass of macro expansion over $thingy. Macros to expand are given in the HASH-ref \%macros. Only string-substitutions on non-reference scalar lvalues in $thingy are performed. No checks for circular references in $thingy are performed.

(Back to Top)


ACKNOWLEDGEMENTS

Perl by Larry Wall.

(Back to Top)


AUTHOR

Bryan Jurish <moocow@ling.uni-potsdam.de>

(Back to Top)


COPYRIGHT AND LICENSE

Copyright (C) 2006 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

(Back to Top)


SEE ALSO

perl(1), Taxi::Mysql(3perl).

(Back to Top)

 Taxi::Mysql::MacroUtils - extendable full-text index using mysql: macro expansion utilities