Blame lib/Date/Manip/Interfaces.pod

Packit Service 653591
# Copyright (c) 1995-2017 Sullivan Beck. All rights reserved.
Packit Service 653591
# This program is free software; you can redistribute it and/or modify it
Packit Service 653591
# under the same terms as Perl itself.
Packit Service 653591
Packit Service 653591
=pod
Packit Service 653591
Packit Service 653591
=head1 NAME
Packit Service 653591
Packit Service 653591
Date::Manip::Interfaces - A description of functional and OO interfaces
Packit Service 653591
Packit Service 653591
=head1 DESCRIPTION
Packit Service 653591
Packit Service 653591
There are three different ways to use Date::Manip .  A complete description
Packit Service 653591
of each is included below.  They are:
Packit Service 653591
Packit Service 653591
=over 4
Packit Service 653591
Packit Service 653591
=item Functional interface (version 5)
Packit Service 653591
Packit Service 653591
Date::Manip version 5 runs on very old versions of perl.  If you need
Packit Service 653591
to use Date::Manip with a version of perl older than 5.10, this is the
Packit Service 653591
only interface available.
Packit Service 653591
Packit Service 653591
=item Functional interface (version 6)
Packit Service 653591
Packit Service 653591
When Date::Manip was rewritten (version 6), it made use of some features
Packit Service 653591
of perl 5.10 .  This is the recommended interface if you are supporting
Packit Service 653591
a script that uses the functional interface, but where a newer version
Packit Service 653591
of perl is available.
Packit Service 653591
Packit Service 653591
=item Object-oriented interface
Packit Service 653591
Packit Service 653591
The OO interface is the recommended interface wherever possible.  It
Packit Service 653591
is the only one with access to the full functionality of the module.
Packit Service 653591
Packit Service 653591
=back
Packit Service 653591
Packit Service 653591
=head1 VERSION 5 AND VERSION 6
Packit Service 653591
Packit Service 653591
Date::Manip version 5.xx was available for many years, but suffered
Packit Service 653591
from several weaknesses.  It was slow, and did not handle timezones
Packit Service 653591
or daylight saving time correctly.  It was written as a functional
Packit Service 653591
interface, even though an object-oriented interface would have been
Packit Service 653591
better.  It did have the advantage of running on very old versions of
Packit Service 653591
perl (it is known to work on perl 5.6 and may work on even older
Packit Service 653591
versions of perl).
Packit Service 653591
Packit Service 653591
Date::Manip version 6.00 was a complete rewrite of the module.  For
Packit Service 653591
detailed information about the differences, please refer to the
Packit Service 653591
L<Date::Manip::Changes5to6> document.  The rewrite was needed in order
Packit Service 653591
to handle timezone operations, in addition to many other improvements
Packit Service 653591
including much better performance and more robust parsing.
Packit Service 653591
Packit Service 653591
The rewrite made use of features introduced in perl 5.10 which made
Packit Service 653591
the date parsing routines significantly cleaner.  In addition, the
Packit Service 653591
6.xx release was written as an object oriented set of modules which
Packit Service 653591
are much more powerful than the older functional interface.  For
Packit Service 653591
backward compatibility, a new functional interface was rewritten
Packit Service 653591
(which is simply a set of wrapper functions which call the OO methods)
Packit Service 653591
which is almost entirely backward compatible with the version 5.xx
Packit Service 653591
interface.
Packit Service 653591
Packit Service 653591
The Date::Manip distribution includes all three of these interfaces:
Packit Service 653591
the older version 5 interface, and both the new OO interface and
Packit Service 653591
the backward compatible functional interface.  Also, all three are
Packit Service 653591
installed, so you can use whichever interface is appropriate.
Packit Service 653591
Packit Service 653591
Since there are three different interfaces available, choosing the
Packit Service 653591
interface is the necessary.
Packit Service 653591
Packit Service 653591
If you are running on a system with a very old version of perl (older than
Packit Service 653591
5.10), the version 5 interface is your only option.
Packit Service 653591
Packit Service 653591
If you are on a system running a newer version of perl, but need to
Packit Service 653591
support a script that was written using the functional interface, then
Packit Service 653591
you can use the version 6 functional interface.
Packit Service 653591
Packit Service 653591
For everyone else, it is strongly recommended that you use the object-oriented
Packit Service 653591
interface.
Packit Service 653591
Packit Service 653591
A more detailed description of each interface is included below.  If
Packit Service 653591
you already know which interface you want to use, just go to the
Packit Service 653591
L<Date::Manip/"SEE ALSO"> section for documentation for each
Packit Service 653591
interface.
Packit Service 653591
Packit Service 653591
=head1 FUNCTIONAL INTERFACE (VERSION 5)
Packit Service 653591
Packit Service 653591
When using a version of perl older than 5.10, this is the only
Packit Service 653591
interface available.  This interface is documented in the
Packit Service 653591
L<Date::Manip::DM5 document>.  This interface has several weaknesses that
Packit Service 653591
need to be understood when using it:
Packit Service 653591
Packit Service 653591
=over 4
Packit Service 653591
Packit Service 653591
=item B<Limited Support>
Packit Service 653591
Packit Service 653591
The version 5 functional interface is no longer being developed, and
Packit Service 653591
only limited support is available for it.
Packit Service 653591
Packit Service 653591
As of December 2012, no development will be done, and I will not
Packit Service 653591
correct any remaining bugs in version 5.  If a patch is supplied by
Packit Service 653591
someone else to fix bugs, I will apply it, provided it applies
Packit Service 653591
cleanly, and the resulting code continues to pass all tests.  I will
Packit Service 653591
not apply patches to add features.
Packit Service 653591
Packit Service 653591
I will continue to distribute version 5 for several years.  I do not
Packit Service 653591
have a date in mind where version 5 will be removed.
Packit Service 653591
Packit Service 653591
=item B<Limited Time Zone Support>
Packit Service 653591
Packit Service 653591
Time zone support is extremely limited, and is often incorrect. The lack
Packit Service 653591
of time zone support was the primary reason for rewriting Date::Manip.
Packit Service 653591
Packit Service 653591
The version 5 interface does not handle daylight saving time changes
Packit Service 653591
correctly.
Packit Service 653591
Packit Service 653591
=item B<Performance Issues>
Packit Service 653591
Packit Service 653591
Considerable time has been spent speeding up Date::Manip, and fairly
Packit Service 653591
simple benchmarks show that version 6 is around twice as fast as
Packit Service 653591
version 5.
Packit Service 653591
Packit Service 653591
=back
Packit Service 653591
Packit Service 653591
Feel free to email me concerns and comments.
Packit Service 653591
Packit Service 653591
=head1 FUNCTIONAL INTERFACE (VERSION 6)
Packit Service 653591
Packit Service 653591
The version 6 functional interface is almost completely identical to
Packit Service 653591
the version 5 functional interface, except that it uses the
Packit Service 653591
object-oriented modules to do all the real work.
Packit Service 653591
Packit Service 653591
Time zone support is greatly improved, but is still somewhat limited.
Packit Service 653591
Since the version 6 interface is backward compatible, dates do not
Packit Service 653591
store time zone information in them, so the programmer is responsible
Packit Service 653591
for keeping track of what time zone each date is in. If you want full
Packit Service 653591
access to the time zone support offered in Date::Manip, you have to
Packit Service 653591
use the object-oriented interface.
Packit Service 653591
Packit Service 653591
For the most part, scripts written for older versions of Date::Manip
Packit Service 653591
will continue to work (and scripts written for the version 6
Packit Service 653591
functional interface will run with the version 5 interface), however
Packit Service 653591
in a few cases, you may need to modify your scripts.  Please refer to
Packit Service 653591
the L<Date::Manip::Migration5to6> document for a list of changes which
Packit Service 653591
may be necessary.
Packit Service 653591
Packit Service 653591
=head1 OBJECT-ORIENTED INTERFACE
Packit Service 653591
Packit Service 653591
As of 6.00, Date::Manip consists of a set of OO modules. Each have
Packit Service 653591
their own document (see the L<Date::Manip/"SEE ALSO"> section).
Packit Service 653591
Packit Service 653591
The OO interface consists of the following modules: L<Date::Manip::Date>,
Packit Service 653591
L<Date::Manip::Delta>, L<Date::Manip::Recur>, L<Date::Manip::TZ>, and
Packit Service 653591
L<Date::Manip::Base>.
Packit Service 653591
Packit Service 653591
The object-oriented interface is the only way to get the full
Packit Service 653591
functionality of Date::Manip. It fully support time zones (and
Packit Service 653591
daylight saving time).
Packit Service 653591
Packit Service 653591
=head1 SELECTING AN INTERFACE
Packit Service 653591
Packit Service 653591
If you are running an older version of perl, the version 5 functional
Packit Service 653591
interface is the only one available to you, and it will automatically
Packit Service 653591
be used.
Packit Service 653591
Packit Service 653591
If you are running a newer version of perl (5.10 or higher), you can
Packit Service 653591
use the object-oriented modules by loading them directly, or you can
Packit Service 653591
use a functional interface.
Packit Service 653591
Packit Service 653591
If you use a functional interface, it will default to the version 6
Packit Service 653591
interface, but you can choose to run the version 5 interface in one
Packit Service 653591
of three ways:
Packit Service 653591
Packit Service 653591
=over 4
Packit Service 653591
Packit Service 653591
=item Using the OO interface
Packit Service 653591
Packit Service 653591
By including any of the following:
Packit Service 653591
Packit Service 653591
   use Date::Manip::Date;
Packit Service 653591
   use Date::Manip::Delta;
Packit Service 653591
   use Date::Manip::Recur;
Packit Service 653591
   use Date::Manip::TZ;
Packit Service 653591
   use Date::Manip::Base;
Packit Service 653591
Packit Service 653591
you have access to the OO interface for the appropriate types of objects.
Packit Service 653591
Packit Service 653591
=item Use the default functional interface
Packit Service 653591
Packit Service 653591
By including:
Packit Service 653591
Packit Service 653591
   use Date::Manip;
Packit Service 653591
Packit Service 653591
in your script, one of the functional interfaces will be loaded.  If you
Packit Service 653591
are running a version of perl older than 5.10, it will automatically be
Packit Service 653591
the version 5 interface.  If you are running a newer version of perl,
Packit Service 653591
it will automatically load the version 6 interface.
Packit Service 653591
Packit Service 653591
=item DATE_MANIP environment variable
Packit Service 653591
Packit Service 653591
By setting the DATE_MANIP environment variable to 'DM5' before running
Packit Service 653591
the perl script, the version 5 interface will be used.
Packit Service 653591
Packit Service 653591
=item Date::Manip::Backend variable
Packit Service 653591
Packit Service 653591
Alternately, you can set the Date::Manip::Backend variable to be 'DM5'
Packit Service 653591
before loading the module. Typically, this will be done in the following
Packit Service 653591
way:
Packit Service 653591
Packit Service 653591
   BEGIN {
Packit Service 653591
        $Date::Manip::Backend = 'DM5';
Packit Service 653591
   }
Packit Service 653591
   use Date::Manip;
Packit Service 653591
Packit Service 653591
=back
Packit Service 653591
Packit Service 653591
Once a functional interface is loaded, you cannot switch between the
Packit Service 653591
version 5 and version 6 interfaces.
Packit Service 653591
Packit Service 653591
=head1 SEE ALSO
Packit Service 653591
Packit Service 653591
Date::Manip        - main module documentation
Packit Service 653591
Packit Service 653591
=head1 LICENSE
Packit Service 653591
Packit Service 653591
This script is free software; you can redistribute it and/or
Packit Service 653591
modify it under the same terms as Perl itself.
Packit Service 653591
Packit Service 653591
=head1 AUTHOR
Packit Service 653591
Packit Service 653591
Sullivan Beck (sbeck@cpan.org)
Packit Service 653591
Packit Service 653591
=cut