NAME
XAS::Utils - A Perl extension for the XAS environment
SYNOPSIS
use XAS::Class
version => '0.01',
base => 'XAS::Base',
utils => 'db2dt dt2db'
;
printf("%s\n", dt2db($dt));
DESCRIPTION
This module provides utility routines that can by loaded into your current namespace.
METHODS
db2dt
This routine will take a date format of YYYY-MM-DD HH:MM:SS and convert it into a DateTime object.
dt2db
This routine will take a DateTime object and convert it into the following string: YYYY-MM-DD HH:MM:SS
trim
Trim the whitespace from the beginning and end of a string.
ltrim
Trim the whitespace from the end of a string.
rtrim
Trim the whitespace from the beginning of a string.
compress
Reduces multiple whitespace to a single space.
spawn
Run a cli command with timeout. Returns output from that command.
exitcode
Decodes perls exit code of a cli process. Returns two items.
Example:
my @output = spawn(-command => "ls -l");
my ($rc, $sig) = exitcode();
daemonize
Become a daemon. This will set the process as a session lead, change to '/', clear the protection mask and redirect stdin, stdout and stderr to /dev/null.
hash_walk
This routine will walk a HOH and does a callback on the key/values that are found. It takes three named parameters:
- -hash
-
The hashref of the HOH.
- -keys
-
An arrayref of the key levels.
- -callback
-
The routine to call with these parameters:
keygen
This routine takes a set of parameters formated like a ExtJS 4.1 request and generates a md5 hash value from them.
init_module
This routine will load and initialize a module. It takes one required parameter and one optinal parameter.
load_module
This routine will load a module.
SEE ALSO
Badger::Utils
XAS::Base
XAS::Class
XAS::Constants
XAS::Exception
XAS::System
XAS::Utils
XAS::Apps::Base::Alerts
XAS::Apps::Base::Collector
XAS::Apps::Base::ExtractData
XAS::Apps::Base::ExtractGlobals
XAS::Apps::Base::RemoveData
XAS::Apps::Database::Schema
XAS::Apps::Templates::Daemon
XAS::Apps::Templates::Generic
XAS::Apps::Test::Echo::Client
XAS::Apps::Test::Echo::Server
XAS::Apps::Test::RPC::Client
XAS::Apps::Test::RPC::Methods
XAS::Apps::Test::RPC::Server
XAS::Collector::Alert
XAS::Collector::Base
XAS::Collector::Connector
XAS::Collector::Factory
XAS::Lib::App
XAS::Lib::App::Daemon
XAS::Lib::App::Daemon::POE
XAS::Lib::Connector
XAS::Lib::Counter
XAS::Lib::Daemon::Logger
XAS::Lib::Daemon::Logging
XAS::Lib::Gearman::Admin
XAS::Lib::Gearman::Admin::Status
XAS::Lib::Gearman::Admin::Worker
XAS::Lib::Gearman::Client
XAS::Lib::Gearman::Client::Status
XAS::Lib::Gearman::Worker
XAS::Lib::Net::Client
XAS::LIb::Net::Server
XAS::Lib::RPC::JSON::Client
XAS::Lib::RPC::JSON::Server
XAS::Lib::Session
XAS::Lib::Spool
XAS::Model::Database
XAS::Model::Database::Alert
XAS::Model::Database::Counter
XAS::Model::DBM
XAS::Monitor::Base
XAS::Monitor::Database
XAS::Monitor::Database::Alert
XAS::Scheduler::Base
XAS::System::Alert
XAS::System::Email
XAS::System::Environment
XAS::System::Logger
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2012 by Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.