The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Hermes - Cluster information interpreter. Extends Hermes::Range

SYNOPSIS

use Hermes;

my $a = Hermes->new( cache => '/database/file' );

$a->load( 'foo{2~9}{??==*=={foo,bar}!!baz}.bar' );

## ... see base class for other methods ...

QUERY

cluster

A cluster query is expressed as a tuple of elements, corresponding to columns of the cache table. See Hermes::DBI::Cache.

Such a query is made when an element is indicated by the select symbol, and the other three are given as query conditions, expressed by a condition symbol followed a range expression. e.g. "{??==*=={foo,bar}!!baz}" may be translated into the following SQL statement,

"SELECT col1 FROM $TABLE WHERE col3 IN ('foo','bar') AND col4!='baz'"

callabck

A callback query is expressed as a callback symbol followed by the callback name, and optionally, followed by a query condition. See Hermes::Call.

e.g. "{%%foo!!bar,baz}" means get all elements returned by callback foo, expect those indexed by bar and baz.

Naturally, '*' in a query condition means 'any', i.e. no condition. And a query expression may be recursive.

SYMBOLS

( in addition to those in the base class )

QUERY

'??' : select
'==' : in
'!!' : not

METHODS

db()

Returns cache db object.

cb()

Returns callback object.

GRAMMAR

( BNF rules additional to those in the base class )

complex

'{' [ <expr> | <call> | <cluster> ] '}'

complex

<call_sym> <string> <query_cond>

cluster

[ <select_symbol> <query_cond> ** 3 ] |
[ <query_cond> <select_symbol> <query_cond> ** 2 ] |
[ <query_cond> ** 2 <select_symbol> <query_cond> ] |
[ <query_cond> ** 3 <select_symbol> ]

query_cond

<condition_symbol> <expr> |
<condition_symbol> <regex>