EVAL
Deprecated, and worse than deprecated: it does not run your code. The palette lists it as
(DEPRECATED) EVAL with the name struck through. Use
Server CODE instead, which runs a Perl or JavaScript block and hands
the result to a stash variable.
The op was meant to evaluate a Perl block and trap run-time errors from it. What it does in practice
is take the contents of the Code field as text and store that text in the stash. Nothing in the
block is executed, so nothing in it can fail, and the error trap it was built around never fires.
A rule containing this op runs past it without doing anything the block describes.
If a rule you have inherited looks like it should be computing something here and is not, this is why. Check the stash at that point and you will find the source of the block sitting in the variable where the result was supposed to be.
Fields¶
Code¶
The Perl block, in a syntax-highlighted editor. Internet Explorer gets a plain text area instead,
with the same label and the same value. The text is stored verbatim and treated as a string. No
${...} expansion happens either, so it lands in the stash exactly as typed.
Return Key¶
Return Key, on the op's Options tab, names the stash variable that receives the block's text.
The name has to be a single word. Leave it empty, or type anything containing a space, and the text is stored under a stash entry with no name at all, which no later op can read.
Replacing it¶
Move the block to Server CODE with Programming language set to
Perl, and put the same name in that op's Return Key. There the last expression of the block is
evaluated and stored, which is what this op was documented to do.
Watch out for one difference while you migrate. Any op downstream that reads the variable has been
receiving a long string for as long as the rule has existed, and after the move it receives a real
value. Conditions written against that string, such as a LIKE test that happened to match a word in
the source, change their answer.
Combining with other ops¶
Nothing pairs usefully with an op that does not run. For the working equivalents, see Server CODE for a block, SET EXPR for a single Perl expression, and EVAL JavaScript for a single JavaScript one.
Example¶
An existing op, and its replacement.
EVAL
Return Key: build_label
Code:
my $n = 41;
'build-' . ( $n + 1 );
Server CODE
Programming language: Perl
Return Key: build_label
Code:
my $n = 41;
'build-' . ( $n + 1 );
The first leaves the two lines of source in build_label. The second leaves build-42.