NAME

App::Dochazka::CLI::Util - Various reusable components

VERSION

Version 0.150

PACKAGE VARIABLES AND EXPORTS

FUNCTIONS

init_logger

Logger initialization routine

init_cli_client

CLI client initialization routine: might die

authenticate_to_server

Takes PROPLIST with three properties:

user

The username to authenticate as

password

The password to use

quiet

(Optional) boolean value whether to "be quiet" - defaults to 0

lookup_employee

EMPLOYEE_SPEC may be "nick=...", "sec_id=...", "eid=...", or simply "employee=...", in which case we use a clever algorithm to look up employees (i.e. try looking up search key as nick, sec_id, and EID - in that order).

refresh_current_emp

REST calls are cheap, so look up $current_emp again just to make sure.

rest_error

Given a non-OK status object and a string briefly identifying (for the user) in which operation the error occurred, check for and report common errors like 404.

Returns a true value if a common error is successfully identified and reported, false otherwise.

truncate_to

Given a string and a maximum length (defaults to 32), truncates to that length. Returns a copy of the string. If any characters were actually removed in the truncate operation, '...' is appended.