Perl extensions

On rare occasions, the internal facilities of TopLeaf are not sufficient, and it's necessary to call in a full fledged programming language to do some particularly difficult transformation or calculation. To facilitate this process, TopLeaf carries its own mini-Perl distribution and provides an interface via which data can be passed between the typesetting process and user defined Perl modules.

Note that TopLeaf invokes a single Perl interpreter for each typesetting run. This means that any (global) variables set in one mapping will be "remembered" in subsequent mappings. Note that the Perl environment is completely separate from the TopLeaf environment, so setting the variable $Width in Perl has no effect whatsoever on the TopLeaf user variable {Width} (or vice-versa). Use the commands described below to pass information back and forth between Perl and TopLeaf.

[Warning] Warning

Those unfamiliar with the Perl language can find documentation at; those who do not require Perl extensions can safely ignore this section.