Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 01330ec25d
Fetching contributors…

Cannot retrieve contributors at this time

70 lines (59 sloc) 2.154 kb
__NAME__ purpose
evaluate the enclosed arithmetic expression or Perl block
__NAME__ synopsis
__NAME__ see also
calc, mvasp, perl
__NAME__ description
The tag evaluates the enclosed arithmetic expression or a &PERL; block.
The last expression evaluated (return value) is returned to the client
Note that Perl blocks can be of arbitrary content and complexity, and there
really are no typical examples to show.
TODO note about safe, note about doc on Perl programming within IC
__NAME__ notes
<!-- if you change this, also change the same in refs/perl -->
The &tag-calc; tag is lower-overhead variant of &tag-perl;, because it
does not accept arguments, does not try to interpolate tag body (well,
&tag-calcn; tag only) , does not
pre-open any database tables, and it doesn't do any extra wrapping.
The &tag-calc; tag will remember variable values inside the page, so you
can do the equivalent of a memory store and memory recall for a loop. In
other words, variables you initialize or set in one &tag-calc; block are
also visible in all further &tag-calc; blocks on the same page.
There is no reason to ever use this tag inside &tag-perl; or &tag-mvasp;.
&tag-calc; and &tag-perl; are the two tags that play major role in any
&PERL; programming within &IC;.
__NAME__ example: Simple Perl code, a random arithmetic expression
Current magic number is: [calc]2+rand[/calc]
__NAME__ example: Retrieving an Interchange session value
Welcome, your user name is [calc]$Tag->data(qw/session username/)[/calc]
__NAME__ example: Setting and displaying a value
Order number is:
[calc] $Session->{mv_order_number} = $Values->{mv_order_number} [/calc]
__NAME__ example: Clearing the return value
You can clear the return value (that is, return nothing) by simply calling
<code>return</code> with no arguments:
[calc] my $a = 5; return [/calc]
Jump to Line
Something went wrong with that request. Please try again.