NAME

Mojolicious::Plugin::Human - Helpers to print values as human readable form.

SYNOPSIS

$self->plugin('Human', {

    # Set money parameters if you need
    money_delim => ",",
    money_digit => " ",

    # Or change date and time strings
    datetime    => '%d.%m.%Y %H:%M',
    time        => '%H:%M:%S',
    date        => '%d.%m.%Y',

    phone_country   => 1,
    phone_region    => 123,
});

DESCRIPTION

You can use this module in Mojo template engine to make you users happy.

CONFIGURATION

money_delim

Set format for human readable delimiter of money. Default: <.>

money_digit

Set format for human readable digits of money. Default: <,>

datetime

Set format for human readable date and time. Default: %F %H:%M

time

Set format for human readable time. Default: %H:%M:%S

datetime

Set format for human readable date. Default: %F

phone_country

Set country code for phones functions. Default: 7

phone_region

Set region code for phones functions. Default: 495

DATE AND TIME HELPERS

str2time

Get string, return timestamp

strftime

Get string, return formatted string

human_datetime

Get string, return date and time string in human readable form.

human_time

Get string, return time string in human readable form.

human_date

Get string, return date string in human readable form.

MONEY HELPERS

human_money

Get number, return money string in human readable form with levels.

PHONE HELPERS

human_phones

Get srtring, return phones (if many) string in human readable form.

flat_phone

Get srtring, return flat phone string.

TEXT HELPERS

human_suffix $str, $count, $one, $two, $many

Get word base form and add some of suffix ($one, $two, $many) depends of $count

DISTANCE HELPERS

human_distance

Return distance, without fractional part if possible.

INTERNAL FUNCIONS

clean_phone $phone, $country, $region

Clear phones. Fix first local digit 8 problem.

Return <undef> if phome not correct

human_phone

Make phone string in human readable form.

date_parse $str

Get a string and return DateTime or undef.

AUTHORS

Dmitry E. Oboukhov <unera@debian.org>, Roman V. Nikolaev <rshadow@rambler.ru>

COPYRIGHT

Copyright (C) 2011 Dmitry E. Oboukhov <unera@debian.org> Copyright (C) 2011 Roman V. Nikolaev <rshadow@rambler.ru>

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.