RT 4.2.12 Documentation
RT::Interface::CLI
NAME
RT::Interface::CLI - helper functions for creating a commandline RT interface
SYNOPSIS
use lib "/opt/rt4/local/lib", "/opt/rt4/lib";
use RT::Interface::CLI qw(GetCurrentUser Init loc);
# Process command-line arguments, load the configuration, and connect
# to the database
Init();
# Get the current user all loaded
my $CurrentUser = GetCurrentUser();
print loc('Hello!'); # Synonym of $CurrentUser->loc('Hello!');
DESCRIPTION
METHODS
CleanEnv
Removes some of the nastiest nasties from the user's environment.
GetCurrentUser
Figures out the uid of the current user and returns an RT::CurrentUser object
loaded with that user. if the current user isn't found, returns a copy of RT::Nobody.
loc
Synonym of $CurrentUser->loc().
Init
A shim for "GetOptions" in Getopt::Long which automatically adds a --help option if it is not supplied. It then calls "LoadConfig" in RT and "Init" in RT.
It sets the LogToSTDERR setting to warning, to ensure that the user sees all relevant warnings. It also adds --quiet and --verbose options, which adjust the LogToSTDERR value to error or debug, respectively.