NAME
App::MonM::Notifier::Util - Utility tools
VERSION
Version 1.00
SYNOPSIS
use App::MonM::Notifier::Util;
DESCRIPTION
Utility tools
getExpireOffset
print getExpireOffset("+1d"); # 86400
print getExpireOffset("-1d"); # -86400
Returns offset of expires time (in secs).
Original this function is the part of CGI::Util::expire_calc!
This internal routine creates an expires time exactly some number of hours from the current time. It incorporates modifications from Mark Fisher.
format for time can be in any of the forms:
now -- expire immediately
+180s -- in 180 seconds
+2m -- in 2 minutes
+12h -- in 12 hours
+1d -- in 1 day
+3M -- in 3 months
+2y -- in 2 years
-3m -- 3 minutes ago(!)
If you don't supply one of these forms, we assume you are specifying the date yourself
calcPostponetPubDate
my $newpubdate = calcPostponetPubDate( $user_config_struct );
Returns new the "public date" value for record in database for user
checkLevel
my $status = checkLevel( $conf_level, $test_level );
This functions checks permissions to send a message by $test_level of the message
checkPubDate
my $status = checkPubDate( $user_config_struct );
Returns the sign (BOOL) of the permission to send a message (allowed or not allowed) by public date
getPeriods
my %periods = getPeriods( $user_config_struct );
my %periods = getPeriods( $user_config_struct, $channel_name );
This function returns periods on everyday of week for all channels or only for specified
Format of the returned hash-structure:
monday => [start_time, finish_time],
mysleep
mysleep( $secs );
This function do a delay in safety mode. See sleep Perl-function
trim
my $trimmed = trim( $text );
Trims the start and end of a line
tz_diff
print tz_diff( time );
Returns TimeZone difference value
is_ipv4
is_ipv4("127.0.0.1") ? "OK" : "NO";
Returns true or false if argument has not IPv4
resolve
my $name = resolve("127.0.0.1");
my $ipv4 = resolve("localhost");
Returns IP/Hostname by Hostname/IP. See "resolv" in Sys::Net
is_iso8601
is_iso8601("2017-11-28T10:12:14Z") ? "OK" : "NO";
Return true or false if argument has not ISO 8601
See http://www.w3.org/TR/NOTE-datetime
time2iso
my $iso = time2iso( time() );
Converts time() fromat to ISO 8601 format
See http://www.w3.org/TR/NOTE-datetime
iso2time
my $tm = time2iso( "2017-11-28T10:12:14Z" );
Converts Date and Time in ISO 8601 format to time() format
See http://www.w3.org/TR/NOTE-datetime
HISTORY
See CHANGES
file
DEPENDENCIES
TO DO
See TODO
file
BUGS
* none noted
SEE ALSO
AUTHOR
Sergey Lepenkov (Serz Minus) http://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See LICENSE
file