NAME
Mojo::Hakkefuin::Utils - Utilities
SYNOPSIS
use Mojo::Hakkefuin::Utils;
my $utils = Mojo::Hakkefuin::Utils->new;
# to generate cookie
my $cookie = $utils->gen_cookie;
# to generate sql time
my $sql_time = $utils->sql_datetime;
# to generate time by the abbreviation
my $time = $utils->time_convert('1d');
DESCRIPTION
General utilities which used on Backend and plugin class.
METHODS
Mojo::Hakkefuin::Utils inherits all methods from Mojo::Base and implements the following new ones.
gen_cookie
my $cookie = $utils->gen_cookie;
my $cookie = $utils->gen_cookie(3);
This method only generate cookie login.
sql_datetime
my $sql_time = $utils->sql_datetime;
my $sql_time = $utils->sql_datetime(60 * 60);
This method only generate datetime.
time_convert
# To get 1 hour in units of seconds.
my $time = $utils->time_convert;
# time specified by the abbreviation
my $time = $utils->time_convert('1d');
Abbreviation of time :
s = seconds.
m = minutes
h = hours
d = days
w = weeks
M = months
y = years