Acrux

 view release on metacpan or  search on metacpan

lib/Acrux/Util.pm  view on Meta::CPAN


    # HTTP headers format (See CGI::Util::expires)
    say fdt("%w, %DD %MON %YYYY %hh:%mm:%ss %G", time, 1); # Tue, 12 Feb 2013 13:35:04 GMT

    # HTTP/cookie format (See CGI::Util::expires)
    say fdt("%w, %DD-%MON-%YYYY %hh:%mm:%ss %G", time, 1); # Tue, 12-Feb-2013 13:35:04 GMT

    # COOKIE (RFC2616 as rfc1123-date)
    say fdt("%w, %DD %MON %YYYY %hh:%mm:%ss %G", time, 1); # Tue, 12 Feb 2013 13:35:04 GMT

For more features please use L<Date::Format>, L<DateTime> and L<POSIX/strftime>

=head2 fduration

    print fduration( 123 );

Returns formatted duration value

=head2 humanize_duration

    print humanize_duration ( 123 );

t/02-util.t  view on Meta::CPAN

#
# Copyright (C) 1998-2024 D&D Corporation. All Rights Reserved
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#########################################################################
use Test::More;
use Acrux::Util qw/fdatetime truncstr words/;

ok(fdatetime(time), 'DateTime');

# TruncSTR
{
	is(truncstr("qwertyuiop", 3), 'q.p', 'Truncate string to 3 symbols');
	is(truncstr("qwertyuiop", 7, '*'), 'qw***op', 'Truncate string to 7 symbols');
}

#note fdt("%DD.%MM.%YYYY %hh:%mm:%ss %Z %z"); # 12.02.2013 16:16:53
#my $data = indent("foo", 1, '> ');
#note $data;



( run in 0.306 second using v1.01-cache-2.11-cpan-05444aca049 )