The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::MonM::Util - Internal utilities

VERSION

Version 1.01

SYNOPSIS

    use App::MonM::Util qw/
            explain expire_calc
        /;

    print explain( $object );

DESCRIPTION

Internal utilities

FUNCTIONS

explain
    print explain( $object );

Returns Data::Dumper dump

blue, cyan, green, red, yellow
    print cyan("Format %s", "text");

Returns colored string

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

getBit
    print getBit(123, 3) ? "SET" : "UNSET"; # UNSET

Getting specified Bit

node2anode
    my $anode = node2anode({});

Returns array of nodes

set2attr
    my $hash = set2attr({set => ["AttrName Value"]}); # {"AttrName" => "Value"}

Converts attributes from the "set" format to regular hash

setBit
    printf("%08b", setBit(123, 3)); # 01111111

Setting specified Bit. Returns new value.

HISTORY

See Changes file

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/