PREFIX-calc
Summary
- [PREFIX-calc] Perl code [/PREFIX-calc]
Description
Executes the Perl code given in the tag's body text.
This is equivalent to the [calc] tag,
except that it's calculated at loop time instead of later,
when the rest of the page is parsed.
The following example adds 2 to the current item's price
(see [PREFIX-price]),
and returns the result:
|
[PREFIX-calc] [PREFIX-price noformat] + 2 [/PREFIX-calc]
|
[PREFIX-calc] blocks may make use of a "$Row" hashref,
which contains the current row data.
The following demonstrates the use of the "$Row" hashref:
[item-calc]
if ($Row->{rip_off} eq 'Y') {
return $Row->{weight} + 10;
}
else {
return $Row->{weight};
}
[/item-calc]
|
|
Warning
No changes will be made to the underlying table data if you
make changes to the values in the "$Row" hashref.
|
|
Availability
The "$Row" hashref was introduced in version 5.3.2,
and is therefore not available for use in any earlier
Interchange version.
|