Time-Format

 view release on metacpan or  search on metacpan

lib/Time/Format.pm  view on Meta::CPAN

=for gpg
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

=encoding utf8

=head1 NAME

Time::Format - Easy-to-use date/time formatting.

=head1 VERSION

This is version 1.16 of Time::Format, February 19, 2020.

=cut

use strict;
package Time::Format;
$Time::Format::VERSION  = '1.16';

# This module claims to be compatible with the following versions
# of Time::Format_XS.
%Time::Format::XSCOMPAT = map {$_ => 1} qw(1.01 1.02 1.03);

sub _croak
{
    require Carp;
    goto &Carp::croak;
}

# Store the file offset of the __DATA__ region.
my $data_pos = tell DATA;
close DATA;                     # so we don't hold a lock on this file.

# Here we go through a bunch of tests to decide whether we can use the
# XS module, or if we need to load and compile the perl-only
# subroutines (which are stored in __DATA__).
my $load_perlonly = 0;
$load_perlonly = 1  if defined $Time::Format::NOXS  &&  $Time::Format::NOXS;

if (!$load_perlonly)
{
    # Check whether the optional XS module is installed.
    eval { require Time::Format_XS };

    if ($@  ||  !defined $Time::Format_XS::VERSION)
    {
        $load_perlonly = 1;
    }
    else
    {
        # Check that we're compatible with them (backwards compatibility)
        # or they're compatible with us (forwards compatibility).
        unless ($Time::Format::XSCOMPAT{$Time::Format_XS::VERSION}
            ||  $Time::Format_XS::PLCOMPAT{$Time::Format::VERSION})
        {
            warn "Your Time::Format_XS version ($Time::Format_XS::VERSION) "
               . "is not compatible with Time::Format version ($Time::Format::VERSION).\n"
               . "Using Perl-only functions.\n";
            $load_perlonly = 1;
        }

lib/Time/Format.pm  view on Meta::CPAN


 %strftime
 %manip
 time_strftime
 time_manip

The C<:all> tag will import all of these into your namespace.
Example:

 use Time::Format ':all';

=head1 LIMITATIONS

The format string used by C<%time> must not have $; as a substring
anywhere.  $; (by default, ASCII character 28, or 1C hex) is used to
separate values passed to the tied hash, and thus Time::Format will
interpret your format string to be two or more arguments if it
contains $;.  The C<time_format> function does not have this
limitation.

=head1 REQUIREMENTS

 Time::Local
 I18N::Langinfo, if you want non-English locales to work.
 POSIX, if you choose to use %strftime or want the C<tz> format to work.
 Time::HiRes, if you want the C<mmm> and C<uuuuuu> time formats to work.
 Date::Manip, if you choose to use %manip.

 Time::Format_XS is optional but will make C<%time> and C<time_format>
     much faster.  The version of Time::Format_XS installed must match
     the version of Time::Format installed; otherwise Time::Format will
     not use it (and will issue a warning).

=head1 AUTHOR / COPYRIGHT

Copyright (c) 2003-2020 by Eric J. Roode, ROODE I<-at-> cpan I<-dot-> org

All rights reserved.

To avoid my spam filter, please include "Perl", "module", or this
module's name in the message's subject line, and/or GPG-sign your
message.

This module is copyrighted only to ensure proper attribution of
authorship and to ensure that it remains available to all.  This
module is free, open-source software.  This module may be freely used
for any purpose, commercial, public, or private, provided that proper
credit is given, and that no more-restrictive license is applied to
derivative (not dependent) works.

Substantial efforts have been made to ensure that this software meets
high quality standards; however, no guarantee can be made that there
are no undiscovered bugs, and no warranty is made as to suitability to
any given use, including merchantability.  Should this module cause
your house to burn down, your dog to collapse, your heart-lung machine
to fail, your spouse to desert you, or George Bush to be re-elected, I
can offer only my sincere sympathy and apologies, and promise to
endeavor to improve the software.


=begin gpg

-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQTSmjxiQX/QfjsCVJLChJhzmpBWqgUCXk1aEwAKCRDChJhzmpBW
qu/jAKCil0ppbfA+FbEEub5E41qEWajl7wCfclrwa5dGIHb1+jL9sAVmACjvKlg=
=pSH2
-----END PGP SIGNATURE-----

=end gpg



( run in 0.625 second using v1.01-cache-2.11-cpan-df04353d9ac )