NAME

Elive::Util - Utility functions for Elive

METHODS

inspect_type

$type = Elive::Util::inspect_type('Elive::Entity::Participants');
if ($type->is_array) {
    # ...
}

Returns an object of type Elive::Util::Type.

prompt

my $password = Elive::Util::prompt('Password: ', password => 1)

Prompt for user input

string

print Elive::Util::string($myscalar);
print Elive::Util::string($myobj);
print Elive::Util::string($myref, $datatype);

Return a string for an object. This method is widely used for casting objects to ids.

  • If it's a simple scalar, just pass the value back.

  • If it's an object use the stringify method.

  • If it's a reference, resolve datatype to a class, and use its stringify method.

next_quarter_hour

Quarter hour advancement for the Time Module impoverished.

my $start = Elive::Util::next_quarter_hour();
my $end = Elive::Util::next_quarter_hour($start);

Advance to the next quarter hour without the use of any supporting time modules. We just simply increment in seconds until localtime indicates that we're exactly on a quarter hour and ahead of the start time.

A small initial increment is added to ensure that the date remains in the future, allowing for minor gotchas such as leap seconds, general latency and smallish time drifts between the client and server.