NAME
Cache::ObjectScript - Source Filter for embedding ObjectScript expressions in Perl
SYNOPSIS
use Cache::ObjectScript;
my $a = 1;
$a = <? :a +1:>:
<:K ^foobar(:a):>
no Cache::ObjectScript; # disable source filter
DESCRIPTION
This module allows you to embed ObjectScript expressions enclosed in "<?" ... ":>" or ObjectScript statements in "<:" ... ":>"
The expressions are not evaluated, they are compiled into ObjectScript functions for everlasting speed.
You can use bind variables using :var
notation.
Generated routines are named CPERLxxxxxxxxxxxxxxxxxxxxxxxxx
where each x
stands for a hexadecimal digit.
This is currently the md5sum (except last 7 digits) over the version of this module and the expression.
Anyway this may change (do not rely on that :), but I gurarantee that I only generate routines named "CPERL*".
If you just want to evaluate a Cache-String (i.e: a non constant expression) use CacheEval $string
of the Cache
package.
You could also the following instead:
my $eval = "K GeorgeBush"; # this is a political statement :)
<: @:eval:>
but it doesn't look so fine :) If you got this, you've probably understand that module.
If you insist to write order-loops, try something like this:
my $a="";
do {
$a = <?$order(^rOBJ(:a)):>;
print "$a\n";
} while length $a;
EXPORTS
none.
BUGS
Design: This Module creates a routine for every <[:?] ... :> expression.
It should create a single routine for each Perl source file.
(The current design "eats" routine-buffers)
I'm going to change that but that's not too high on my priority list.
(Finding a girlfriend is :)
SEE ALSO
Cache, Cache::Global, Cache::Routine, Cache::Util, Cache::Bind.
AUTHOR
Stefan Traby <stefan@hello-penguin.com>
http://hello-penguin.com