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