3.7. Autoload

Sets an action that is automatically performed for every access. It is performed before any page parsing occurs, and before the action or page is even determined. It can be set to a string containing ITL tags or to the name of a catalog (Sub) or global subroutine. The return value from the code run is discarded.

For example, to automatically run the Sub or GlobalSub named 'testsub':

   Autoload testsub

To remap any mv_nextpage accesses to the private subdirectory of pages, set:

   Autoload   [perl] $CGI->{mv_nextpage} =~ s:^private/:public/:; [/perl]

You can temporarily change any of the catalog configuration settings, for example, to use a different flypage depending on the user's browser type:

   Autoload       <<EOA
   [perl]
   if ($Session->{browser} =~ /msie/i) {
      $Config->{Special}->{flypage} = 'ie_flypage';
   }
   [/perl]
   EOA

Please note that SpecialPage is the corresponding directive in the catalog configuration, not Special. This is an exceptional case. Usually the hash key has the same name as the catalog configuration directive.