The <perl-call/> command

Once a subroutine has been defined with <perl-use/>, it can be executed using the following syntax variants:

  • Zero argument form (the empty arg is required):

    <perl-call sub="SUB" arg=""/>
  • Single argument form:

    <perl-call sub="SUB" arg="ARG1"/>


    <perl-call sub="SUB" copy="VN1"/>
  • Multi-argument form:

    <perl-call sub="SUB">
    <perl-arg string="ARG1"/>
    <perl-arg copy="VN2"/>
    . . .

where SUB is the name of the subroutine being called, ARG1, ARG2 etc. are strings to be passed as arguments, and VN1, VN2 etc. are the names of TopLeaf variables that contain the arguments. If a copy attribute is present, then any arg or string attribute is silently ignored.

The named subroutine is executed with the supplied arguments (if any). As for modules, STDIN, STDOUT and STDERR are disabled. Unlike modules, the subroutine is executed each time a <perl-call/> is encountered.

[Note] Note

A perl subroutine can only pass information back to TopLeaf via pre-declared subroutines, described in the following sections. See “Passing XML structure into and out of Perl extensions” for details on how XML fragments are passed to and from Perl.