RT::Interface::CLI(3)

NAME
  RT::Interface::CLI - helper functions for creating a commandline RT interface

SYNOPSIS
  use lib "!!RT_LIB_PATH!!";
  use lib "!!RT_ETC_PATH!!";

  use RT::Interface::CLI  qw(CleanEnv LoadConfig DBConnect
                           GetCurrentUser GetMessageContent);

  #Clean out all the nasties from the environment
  CleanEnv();

  #Load etc/config.pm and drop privs
  LoadConfig();

  #Connect to the database and get RT::SystemUser and RT::Nobody loaded
  DBConnect();

  #Get the current user all loaded
  my $CurrentUser = GetCurrentUser();

DESCRIPTION

METHODS

  CleanEnv
Removes some of the nastiest nasties from the user\'s environment.

  LoadConfig
Loads RT's config file and then drops setgid privileges.

  DBConnect
  Calls RT::Init, which creates a database connection and then creates $RT::Nobody
  and $RT::SystemUser

  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.

  GetMessageContent
Takes two arguments a source file and a boolean "edit". If the source file is undef or "", assumes an empty file. Returns an edited file as an array of lines.