Cac::ObjectScript - Source Filter for embedding ObjectScript expressions in Perl
use Cac::ObjectScript; my $a = 1; $a = <? :a +1:>: <:K ^foobar(:a):> no Cac::ObjectScript; # disable source filter
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.
:var
Generated routines are named CPERLxxxxxxxxxxxxxxxxxxxxxxxxx where each x stands for a hexadecimal digit.
CPERLxxxxxxxxxxxxxxxxxxxxxxxxx
x
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 CacEval $string of the Cac package.
CacEval $string
Cac
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;
none.
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 :)
Cac, Cac::Global, Cac::Routine, Cac::Util, Cac::Bind.
Stefan Traby <stefan@hello-penguin.com> http://hello-penguin.com
To install Cac, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cac
CPAN shell
perl -MCPAN -e shell install Cac
For more information on module installation, please visit the detailed CPAN module installation guide.