2.25. GlobalSub *global*

Defines a global subroutine for use by the [perl sub] subname arg /perl] construct. Use the "here document" capability of Interchange configuration files to make it easy to define:

   GlobalSub <<EOF

   sub count_orders {
       my $counter = new File::CounterFile "/tmp/count_orders", '1';
       my $number = $counter->inc();
       return "There have been $number orders placed.\n";

As with Perl "here documents," the EOF (or other end marker) must be the ONLY thing on the line, with no leading or trailing white space. Do not append a semicolon to the marker. (The above marker appears indented. It should not be that way in the file!)

IMPORTANT NOTE: These global subroutines are not subject to security checks. They can do most anything! For most purposes, scratch subroutines or catalog subroutines (also Sub) are better.

GlobalSub routines are subject to full Perl use strict checking, so errors are possible if lexical variables or complete package qualifications are not used for the variables.