NAME

MPMinus::Util - Utility functions

VERSION

Version 1.25

SYNOPSIS

    use MPMinus::Util;

    my $fsecs = getHiTime();
    my $sid = getSID( 20 );

    my $login = MPMinus::Util::correct_loginpass( "anonymous" ); # 'anonymous'
    my $md5_apache = MPMinus::Util::get_md5_apache( "password" );
    my $md5_unix = MPMinus::Util::get_md5_unix( "password" );

DESCRIPTION

MPMinus utilities

FUNCTIONS

getHiTime

    my $fsecs = getHiTime();

Returns a floating seconds since the epoch. See function "gettimeofday" in Time::HiRes

Please note! This function is not exported automatically!

get_md5_apache

    my $md5_apache = get_md5_apache( "password" );

Returns MD5-hash digest of "password" value in apache notation

Please note! This function is not exported automatically!

get_md5_unix

    my $md5_unix = get_md5_unix( "password" );

Returns MD5-hash digest of "password" value in unix notation

getSID

    my $sid = getSID( $length, $chars );
    my $sid = getSID( 16, "m" ); # 16 successful chars consisting of MD5 hash
    my $sid = getSID( 20 ); # 20 successful chars consisting of a set of chars 0-9A-Z
    my $sid = getSID(); # 16 successful chars consisting of a set of chars 0-9A-Z

Function returns Session-ID (SID)

$chars - A string containing a collection of characters or code:

    d - characters 0-9
    w - characters A-Z
    h - HEX characters 0-9A-F
    m - Digest::MD5 function from Apache::Session::Generate::MD5
      - default characters 0-9A-Z

correct_loginpass

    my $login = correct_loginpass( "anonymous" ); # 'anonymous'
    my $password = correct_loginpass( "{MOON}" ); # ''

Correcting a login or password. Issued lc() format username / password thatmust not contain characters other than those listed:

    a-zA-Z0-9.,-_!@#$%^&*+=/\~|:;

Otherwise, it returns an empty value ('')

Please note! This function is not exported automatically!

msoconf2args

    my %args = msoconf2args($m->conf('store'));
    my $mso = new MPMinus::Store::MultiStore(
        -m   => $m,
        -mso => \%args,
    );

Converting MSO configuration section to MultiStore -mso arguments

In conf/mso.conf:

    <store foo>
        dsn   DBI:mysql:database=NAME;host=HOST
        user  login
        pass  password
        <Attr>
            mysql_enable_utf8 1
            RaiseError        0
            PrintError        0
        </Attr>
    </store>

    <store bar>
        dsn   DBI:Oracle:SID
        user  login
        pass  password
        <Attr>
            RaiseError        0
            PrintError        0
        </Attr>
    </store>

Please note! This function is not exported automatically!

HISTORY

1.00 / 27.02.2008

Init version on base mod_main 1.00.0002

1.10 / 01.04.2008

Module is merged into the global module level

1.11 / 12.01.2009

Fixed bugs in functions *datatime*

1.12 / 27.02.2009

Module is merged into the global module level

1.20 / 28.04.2011

Binary file's mode supported

1.21 / 14.05.2011

modified functions tag and slash

1.22 / 19.10.2011

Added function datetime2localtime and localtime2datetime as alias for localtime2date_time.

Added alias current_datetime for current_date_time

1.23 / Wed Apr 24 14:53:38 2013 MSK

General refactoring

1.24 / Wed May 8 15:37:02 2013 MSK

Added function msoconf2args

See Changes file

DEPENDENCIES

mod_perl2, CTK, Time::HiRes, Digest::MD5

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

mod_perl2

AUTHOR

Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/