NAME

Krang::Script - loader for the Krang scripts


SYNOPSIS

  # load normally
  use Krang::ClassLoader 'Script';
  # load without switching priviliges
  use Krang::ClassLoader Script => 'no_su';
  # load without checking $ENV{KRANG_INSTANCE}
  use Krang::ClassLoader Script => 'instance_agnostic';


DESCRIPTION

This module exists to load and configure the Krang system for command-line scripts.

The first thing the module does is call any registered addon InitHandlers. See add_on.pod for details.

Next Krang attempts to become the configured KrangUser and KrangGroup, unless passed the 'no_su' option. If you're not already KrangUser then you'll need to be root in order to change into KrangUser.

Next the module sets REMOTE_USER to the user ID of the special hidden 'system' user. This user has global admin access to all Krang instances. However, as the 'system' user ID may differ across instances, this module exports the function set_remote_user() to set the $ENV{REMOTE_USER} variable explicitly to the 'system' user. This function must be called after setting the instance.

This module will exit with an error if your krang.conf has multiple instances but you didn't set the KRANG_INSTANCE environment variable.

If your script is instance-agnostic and you just need to become KrangUser and KrangGroup, you may pass the 'instance_agnostic' option.

If you set KRANG_PROFILE to 1 then Krang::Profiler will be used.


INTERFACE