NAME
OP::Utility - System functions required globally by OP
SYNOPSIS
use OP::Utility;
ENVIRONMENT
Using this module will enable backtraces for all warns and fatals. The messages are informative and nicely formatted, but can be quite verbose. To disable them, set the environment variable OP_QUIET
to 1
.
FUNCTIONS
humanSize($seconds, [$optionalSuffix]);
Convert the received byte count to something more human-readable (eg Kilo, Mega, Giga). Optionally acceps a second argument to use as a "suffix" to the label, otherwise the word "Bytes" is used.
humanTime($seconds);
Convert the received number of seconds into something more human-readable (eg Minutes, Hours, Years)
loadYaml($path);
Load the YAML file at the specified path into a native Perl data structure.
randstr()
Return a random 6-byte alphabetic string
timestamp([$time])
Return the received unix epoch seconds as YYYY-MM-DD HH:MM:DD. Uses the current time if none is provided.
date([$time]);
Return the received unix epoch seconds as YYYY-MM-DD. Uses the current time if none is provided.
time([$time]);
Return the received unix epoch seconds as hh:mm:ss. Uses the current time if none is provided.
hour([$time]);
Return the received unix epoch seconds as the current hour of the day. Uses the current time if none is provided.
decodeExitStatus($status);
Decodes the status ($?) from running perl's system(). Returns exit code, signal, and core dump true/false
newId();
Return a new alpha-numeric ID (GUID).
warnHandler([$exception])
Pretty-print a warning to STDERR
dieHandler([$exception])
Pretty-print a fatal error to STDERR
formatErrorString($errStr)
Backtrace formatter called by error printing functions.
SEE ALSO
This file is part of OP.