3.5.31. StartupHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function that will be called during server startup and restarts. Only one argument is passed to the hook: $_[0] will be set to undef during startup and 1 for a restart (usually due to a SIGHUP).
The hook code is compiled by Perl when Radiator starts up. Compilation errors in your hook code will be reported to the log file at start-up time. Runtime errors in your hook will also be reported to the log file when your hook executes. Multiline hooks (i.e. with trailing backslashes (\)) are parsed by Radiator into one long line. Therefore you should not use trailing comments in your hook.
StartupHook can be an arbitrarily complicated Perl function, that might run external processes, consult databases, change or set up environment variables, umasks etc.
# Set up a umask to use for the life of this process
StartupHook sub { umask(0222);}