The following module was proposed for inclusion in the Module List:
modid: Criteria::Compile
DSLIP: adpOp
description: Describe wanted objects/data using grammar
userid: ALUCAS (Anthony J Lucas)
chapterid: 23 (Miscellaneous_Modules)
communities:
#perl on irc.freenode.net
similar:
rationale:
"find me an X which looks like Y, has a Z, and a H bigger than 10"
This pretty much sums up this module. It provides a simple perl-ish
format and grammar to describe values of all types (or can easily be
extended to). Whenever you've needed to accept criteria, or
intertwine 20 if-statements together to check for just the right
combination of attributes, this module would have saved you a lot of
time, ugliness, and given you a standard and simple syntax.
And if you ever wanted to take all that noise out of your code and
put it to the side, maybe in a config file (e.g. ), this format is
written to play nice with any serialisation / de-serialisation you
wish to do!
I have not seen any modules attempt to accomplish this. The
approach taken allows this module's framework to extend to all perl
data types and objects, and enhance other modules.
The important part is that this is simple and unobtrusive enough to
be extended to anyone's needs, or so the aim goes!
I plan that additional criteria types that I or anyone wishes to
write will live under Criteria::* (e.g. Criteria::File, exposing
file stat criteria). Although useful alone, they will have the
ability to be built and compiled into "wanted" subroutines using
Criteria::Compile. Allowing you to encapsulate complex criteria into
a simple scalar (coderef).
This module is the simple "correct" implementation (or my take on
that :-)). Underneath each criterion is compiled to a separate
"boolean" subroutine so don't expect blazing performance when
high-volume, high-speed usage is required. I am playing with the
idea of an additional XS implementation, or at least a B:: one to
flatten the OP tree down to a single subroutine call, but this would
be a less extensible approach; as always it's a trade-off.
- END RANT :P
enteredby: ALUCAS (Anthony J Lucas)
enteredon: Sat Nov 26 00:00:44 2011 GMT
The resulting entry would be:
Criteria::
::Compile adpOp Describe wanted objects/data using grammar ALUCAS
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=27800000_7bf92ad2f5a3a1ab&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=27800000_7bf92ad2f5a3a1ab&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=Criteria%3A%3ACompile