topper::config - Configuration handler
use topper::config;
my $config = topper::config->new();
$config->load('path/to/somefile.conf');
my $ps_command = $config->get_ps_command();
This package stores global application-wide settings, and handles loading user-configureable settings from a configuration file.
new(topper::output output_handler)Constructor. Initialises class member variables.
Input: topper::output Pass the output handler here. Output: blessed object.
load_config(string filename)This function loads and parses a configuration file. Member variables are set according to values found in the ocnfiguration file. Appropriate errors are shown where there are errors in the configuration file.
Input: (string) The path and filename of the configuration file. Output: (int) Returns 1 on success, 0 on failure.
get_mem_is_percentage()This function returns whether or not the memory value returned by ps_command is a percentage. On GNU+Linux systems it usually is. On IRIX for example, it is typically not.
Input: n/a Output: (number) 0 or 1
get_ps_command()This function gets the configured command to list the processes running on the system. On GNU/Linux systems this will typically be 'ps aux'.
Input: n/a Output: (string) Filename and/or path + commandline options.
get_ps_head_skip()This function gets the configured number of lines to skip from the top of the output of the program launched by the ps_command setting, if any. On GNU/Linux systems this will typically be 1.
Input: n/a. Output: (int) number of lines to skip.
get_ps_tail_skip()This function gets the configured number of lines to skip from the end of the output of the program launched by the ps_command setting, if any. On GNU/Linux systems this will typically be 0.
Input: n/a. Output: (int) number of lines to skip.
get_ps_regex_user()This subroutine returns the configured regular expression for retrieving the user field from the output of the configured 'ps_command' execution.
Input: n/a. Output: (string) configured user field regex.
get_total_system_memory_regexThis subroutine returns the regular expression to parse the output of `total_system_memory_command`.
Input: n/a. Output: (string) configured total_system_memory field regex.
get_total_system_memory_unitThis subroutine returns the unit of measure for the output of `total_system_memory_command` (B,K,M,G,T,Z)
Input: n/a. Output: (string) memory unit used for total_system_memory_command.
get_total_system_memory_commandThis subroutine returns the command used to get the total available system memory.
Input: n/a. Output: (int) total system memory value.
get_ps_regex_pid()This subroutine returns the configured regular expression for retrieving the pid field from the output of the configured 'ps_command' execution.
Input: n/a. Output: (string) configured pid field regex.
get_ps_regex_cpu()This subroutine returns the configured regular expression for retrieving the cpu field from the output of the configured 'ps_command' execution.
Input: n/a. Output: (string) configured cpu field regex.
get_ps_regex_mem()This subroutine returns the configured regular expression for retrieving the mem field from the output of the configured 'ps_command' execution.
Input: n/a. Output: (string) configured mem field regex.
get_ps_regex_name()This subroutine returns the configured regular expression for retrieving the name field from the output of the configured 'ps_command' execution.
Input: n/a. Output: (string) configured name field regex.
get_db_name()This subroutine returns the configured database name.
Input: n/a. Output: (string) configured database name.
get_db_host()This subroutine returns the configured database host.
Input: n/a. Output: (string) configured database host.
get_db_port()This subroutine returns the configured database port.
Input: n/a. Output: (string) configured database port.
get_db_user()This subroutine returns the configured database user.
Input: n/a. Output: (string) configured database user.
get_db_pass()This subroutine returns the configured database password.
Input: n/a. Output: (string) configured database password.