| 1 |
==================================== |
|---|
| 2 |
Package "Date::Calc" Version 5.3 |
|---|
| 3 |
==================================== |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
This package is available for download either from my web site at |
|---|
| 7 |
|
|---|
| 8 |
http://www.engelschall.com/u/sb/download/ |
|---|
| 9 |
|
|---|
| 10 |
or from any CPAN (= "Comprehensive Perl Archive Network") mirror server: |
|---|
| 11 |
|
|---|
| 12 |
http://www.perl.com/CPAN/authors/id/S/ST/STBEY/ |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
Abstract: |
|---|
| 16 |
--------- |
|---|
| 17 |
|
|---|
| 18 |
This package consists of a C library (intended to make life easier for C |
|---|
| 19 |
developers) and a Perl module to access this library from Perl. |
|---|
| 20 |
|
|---|
| 21 |
The library provides all sorts of date calculations based on the Gregorian |
|---|
| 22 |
calendar (the one used in all western countries today), thereby complying |
|---|
| 23 |
with all relevant norms and standards: ISO/R 2015-1971, DIN 1355 and, to |
|---|
| 24 |
some extent, ISO 8601 (where applicable). |
|---|
| 25 |
|
|---|
| 26 |
The package is designed as an efficient (and fast) toolbox, not a bulky |
|---|
| 27 |
ready-made application. It provides extensive documentation and examples |
|---|
| 28 |
of use, multi-language support and special functions for business needs. |
|---|
| 29 |
|
|---|
| 30 |
The C library is specifically designed so that it can be used stand-alone, |
|---|
| 31 |
without Perl. |
|---|
| 32 |
|
|---|
| 33 |
Moreover, versions 5.x feature date objects (in addition to the functional |
|---|
| 34 |
interface) with overloaded operators, and a set of modules for calculations |
|---|
| 35 |
which take local holidays into account (both additions in Perl only, however). |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
What's new in version 5.3: |
|---|
| 39 |
-------------------------- |
|---|
| 40 |
|
|---|
| 41 |
+ Simplified the error message handlers in "Calc.xs". |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
New features in version 5.0: |
|---|
| 45 |
---------------------------- |
|---|
| 46 |
|
|---|
| 47 |
* Many new functions in Date::Calc |
|---|
| 48 |
(but the module continues to be small, fast and simple) |
|---|
| 49 |
|
|---|
| 50 |
* Optionally, Date::Calc objects with overloaded operators |
|---|
| 51 |
for more ease of use (when speed is not so critical) |
|---|
| 52 |
|
|---|
| 53 |
* An optional module for performing date calculations which |
|---|
| 54 |
take holidays into account, e.g., today plus 60 workdays, |
|---|
| 55 |
what date gives that? Or how many workdays are there |
|---|
| 56 |
between two dates? |
|---|
| 57 |
|
|---|
| 58 |
* A library containing profiles for a large number of countries |
|---|
| 59 |
with all their legal holidays (i.e., you get a day off) and |
|---|
| 60 |
many commemorative days (you don't) |
|---|
| 61 |
|
|---|
| 62 |
* The possibility to create your own profiles for any special |
|---|
| 63 |
needs you may have, for instance for schools, banks, stock |
|---|
| 64 |
market, birthdays of relatives and friends, ... |
|---|
| 65 |
|
|---|
| 66 |
* It is easy to generate calendars for any of these profiles |
|---|
| 67 |
and any year you like - there is a script to do so on the |
|---|
| 68 |
command line, and a CGI script for doing so on the web |
|---|
| 69 |
|
|---|
| 70 |
* A couple of new example scripts to illustrate the use of |
|---|
| 71 |
the various modules |
|---|
| 72 |
|
|---|
| 73 |
* Modularized, tailor-made components to assist you in particular |
|---|
| 74 |
tasks, instead of one bulky application larger than your own |
|---|
| 75 |
costing lots of overhead for features you do not need or want |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
Legal issues: |
|---|
| 79 |
------------- |
|---|
| 80 |
|
|---|
| 81 |
This package with all its parts is |
|---|
| 82 |
|
|---|
| 83 |
Copyright (c) 1995 - 2002 by Steffen Beyer. |
|---|
| 84 |
All rights reserved. |
|---|
| 85 |
|
|---|
| 86 |
This package is free software; you can use, modify and redistribute |
|---|
| 87 |
it under the same terms as Perl itself, i.e., under the terms of |
|---|
| 88 |
the "Artistic License" or the "GNU General Public License". |
|---|
| 89 |
|
|---|
| 90 |
The C library at the core of this Perl module can additionally |
|---|
| 91 |
be used, modified and redistributed under the terms of the |
|---|
| 92 |
"GNU Library General Public License". |
|---|
| 93 |
|
|---|
| 94 |
Please refer to the files "Artistic.txt", "GNU_GPL.txt" and |
|---|
| 95 |
"GNU_LGPL.txt" in this distribution, respectively, for details! |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
Prerequisites: |
|---|
| 99 |
-------------- |
|---|
| 100 |
|
|---|
| 101 |
Perl version 5.000 or higher, and an ANSI C compiler. (!) |
|---|
| 102 |
^^^^^^ |
|---|
| 103 |
If you plan to use the modules "Date::Calendar" or |
|---|
| 104 |
"Date::Calendar::Year" from this package, you will |
|---|
| 105 |
also need the module "Bit::Vector" version 5.7 or |
|---|
| 106 |
newer (which also needs an ANSI C compiler!). |
|---|
| 107 |
|
|---|
| 108 |
Otherwise you may safely ignore the warning message |
|---|
| 109 |
"Warning: prerequisite Bit::Vector 5.7 not found at ..." |
|---|
| 110 |
when running "perl Makefile.PL". |
|---|
| 111 |
|
|---|
| 112 |
You can install "Bit::Vector" at any time later if you |
|---|
| 113 |
change your mind. |
|---|
| 114 |
|
|---|
| 115 |
If you compile under Windows, note that you will need |
|---|
| 116 |
exactly the same compiler your Perl itself was compiled |
|---|
| 117 |
with! (This is also true for Unix, but rarely a problem.) |
|---|
| 118 |
|
|---|
| 119 |
Moreover, you usually cannot build any modules under |
|---|
| 120 |
Windows 95/98, the Win 95/98 command shell doesn't |
|---|
| 121 |
grok the "&&" operator. You will need the Windows NT |
|---|
| 122 |
command shell ("cmd.exe") or the "4DOS" shell. |
|---|
| 123 |
|
|---|
| 124 |
Note that ActiveState provides precompiled binaries of |
|---|
| 125 |
both modules (Date::Calc and Bit::Vector) for their |
|---|
| 126 |
Win32 port of Perl ("ActivePerl") on their web site, |
|---|
| 127 |
which you should be able to install simply by typing |
|---|
| 128 |
"ppm install Bit-Vector" and "ppm install Date-Calc" |
|---|
| 129 |
in your MS-DOS command shell (but note the "-" instead |
|---|
| 130 |
of "::" in the package name!). This also works under |
|---|
| 131 |
Windows 95/98. |
|---|
| 132 |
|
|---|
| 133 |
If your firewall prevents "ppm" from downloading these |
|---|
| 134 |
packages, you can also download them manually from |
|---|
| 135 |
http://www.activestate.com/ppmpackages/5.005/zips/ or |
|---|
| 136 |
http://www.activestate.com/ppmpackages/5.6/zips/. |
|---|
| 137 |
Follow the installation instructions included in |
|---|
| 138 |
the "zip" archives. |
|---|
| 139 |
|
|---|
| 140 |
Note also that a "plain Perl" version of "Date::Calc" called |
|---|
| 141 |
"Date::Pcalc" exists (written by J. David Eisenberg); you |
|---|
| 142 |
should be able to download it from the same place where |
|---|
| 143 |
you found this package, or from David's web site at |
|---|
| 144 |
http://catcode.com/date/pcalc.html. |
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
Note to CPAN Testers: |
|---|
| 148 |
--------------------- |
|---|
| 149 |
|
|---|
| 150 |
After completion, version 5.3 of this module has already |
|---|
| 151 |
been tested successfully with the following configurations: |
|---|
| 152 |
|
|---|
| 153 |
Perl 5.005_03 - FreeBSD 4.1.1-RELEASE (with "dlopen() relative paths" patch) |
|---|
| 154 |
Perl 5.6.0 - FreeBSD 4.1.1-RELEASE |
|---|
| 155 |
Perl 5.6.1 - FreeBSD 4.1.1-RELEASE |
|---|
| 156 |
Perl 5.7.0 - FreeBSD 4.1.1-RELEASE |
|---|
| 157 |
Perl 5.7.1 - FreeBSD 4.1.1-RELEASE |
|---|
| 158 |
Perl 5.7.2 - FreeBSD 4.1.1-RELEASE |
|---|
| 159 |
Perl 5.8.0 - FreeBSD 4.1.1-RELEASE |
|---|
| 160 |
Perl 5.005_03 - FreeBSD 4.6-STABLE |
|---|
| 161 |
Perl 5.6.1 - FreeBSD 4.6-STABLE |
|---|
| 162 |
Perl 5.005_03 - Windows NT 4.0 & MS VC++ 6.0 (native Perl build) |
|---|
| 163 |
Perl 5.8.0 - Windows NT 4.0 & MS VC++ 6.0 (native Perl build) |
|---|
| 164 |
Perl 5.6.1 - Windows NT 4.0 & ActivePerl 5.6.1.633 (multi-thread) |
|---|
| 165 |
|
|---|
| 166 |
Note: You can safely ignore the failing tests in module Bit::Vector 6.0 |
|---|
| 167 |
(Bit::Vector::Overload, to be precise) in file "t/30_overloaded.t" under |
|---|
| 168 |
Perl 5.7.1 and Perl 5.7.2. The same applies to older versions of |
|---|
| 169 |
Bit::Vector. |
|---|
| 170 |
|
|---|
| 171 |
The failing tests are due to a change in Perl's core module "overload.pm" |
|---|
| 172 |
which attempts to modify a read-only value when an exception is thrown |
|---|
| 173 |
in the handler of an overloaded operator. This just causes a different |
|---|
| 174 |
error message to be printed than the intended one. |
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
Installation: |
|---|
| 178 |
------------- |
|---|
| 179 |
|
|---|
| 180 |
Please see the file "INSTALL.txt" in this distribution for instructions |
|---|
| 181 |
on how to install this package. |
|---|
| 182 |
|
|---|
| 183 |
It is essential that you read this file since one of the special cases |
|---|
| 184 |
described in it might apply to you, especially if you are running Perl |
|---|
| 185 |
under Windows. |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
Adding more languages: |
|---|
| 189 |
---------------------- |
|---|
| 190 |
|
|---|
| 191 |
Please see the corresponding section in the file "INSTALL.txt" in this |
|---|
| 192 |
distribution for detailed instructions on how to add other languages. |
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
Changes over previous versions: |
|---|
| 196 |
------------------------------- |
|---|
| 197 |
|
|---|
| 198 |
Please refer to the file "CHANGES.txt" in this distribution for a more |
|---|
| 199 |
detailed version history log. |
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
Documentation: |
|---|
| 203 |
-------------- |
|---|
| 204 |
|
|---|
| 205 |
The documentation of this package is included in POD format (= "Plain |
|---|
| 206 |
Old Documentation") in the files with the extension ".pod" in this |
|---|
| 207 |
distribution, the human-readable markup-language standard for Perl |
|---|
| 208 |
documentation. |
|---|
| 209 |
|
|---|
| 210 |
By building this package, this documentation will automatically be |
|---|
| 211 |
converted into man pages, which will automatically be installed in |
|---|
| 212 |
your Perl tree for further reference through the installation process, |
|---|
| 213 |
where they can be accessed by the commands "man Date::Calc" (Unix) |
|---|
| 214 |
and "perldoc Date::Calc" (Unix and Win32 alike), for example. |
|---|
| 215 |
|
|---|
| 216 |
Available man pages: |
|---|
| 217 |
|
|---|
| 218 |
Carp::Clan(3) |
|---|
| 219 |
Date::Calc(3) |
|---|
| 220 |
Date::Calc::Object(3) |
|---|
| 221 |
Date::Calendar(3) |
|---|
| 222 |
Date::Calendar::Profiles(3) |
|---|
| 223 |
Date::Calendar::Year(3) |
|---|
| 224 |
|
|---|
| 225 |
If Perl is not available on your system, you can also read the ".pod" |
|---|
| 226 |
files |
|---|
| 227 |
|
|---|
| 228 |
./Calc.pod |
|---|
| 229 |
./Calendar.pod |
|---|
| 230 |
./lib/Carp/Clan.pod |
|---|
| 231 |
./lib/Date/Calc/Object.pod |
|---|
| 232 |
./lib/Date/Calendar/Profiles.pod |
|---|
| 233 |
./lib/Date/Calendar/Year.pod |
|---|
| 234 |
|
|---|
| 235 |
directly. |
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
What does it do: |
|---|
| 239 |
---------------- |
|---|
| 240 |
|
|---|
| 241 |
This package performs date calculations based on the Gregorian calendar |
|---|
| 242 |
(the one used in all western countries today), thereby complying with |
|---|
| 243 |
all relevant norms and standards: ISO/R 2015-1971, DIN 1355 and, to |
|---|
| 244 |
some extent, ISO 8601 (where applicable). |
|---|
| 245 |
|
|---|
| 246 |
See also http://www.engelschall.com/u/sb/download/Date-Calc/DIN1355/ |
|---|
| 247 |
for a scan of part of the "DIN 1355" document (in German). |
|---|
| 248 |
|
|---|
| 249 |
The module of course handles year numbers of 2000 and above correctly |
|---|
| 250 |
("Year 2000" or "Y2K" compliance) -- actually all year numbers from 1 |
|---|
| 251 |
to the largest positive integer representable on your system (which |
|---|
| 252 |
is at least 32767) can be dealt with. |
|---|
| 253 |
|
|---|
| 254 |
Note that this package projects the Gregorian calendar back until the |
|---|
| 255 |
year 1 A.D. -- even though the Gregorian calendar was only adopted |
|---|
| 256 |
in 1582, mostly by the Catholic European countries, in obedience to |
|---|
| 257 |
the corresponding decree of Pope Gregory XIII in that year. |
|---|
| 258 |
|
|---|
| 259 |
Some (mainly protestant) countries continued to use the Julian calendar |
|---|
| 260 |
(used until then) until as late as the beginning of the 20th century. |
|---|
| 261 |
|
|---|
| 262 |
Therefore, do *NEVER* write something like "99" when you really mean |
|---|
| 263 |
"1999" - or you may get wrong results! |
|---|
| 264 |
|
|---|
| 265 |
Finally, note that this package is not intended to do everything you could |
|---|
| 266 |
ever imagine automagically :-) for you; it is rather intended to serve as a |
|---|
| 267 |
toolbox (in the best of UNIX spirit and tradition) which should, however, |
|---|
| 268 |
always get you where you need and want to go. |
|---|
| 269 |
|
|---|
| 270 |
See the section "RECIPES" at the end of the manual pages for solutions |
|---|
| 271 |
to common problems! |
|---|
| 272 |
|
|---|
| 273 |
If nevertheless you can't figure out how to solve a particular problem, |
|---|
| 274 |
please let me know! (See e-mail address at the bottom of this file.) |
|---|
| 275 |
|
|---|
| 276 |
The new module "Date::Calc::Object" adds date objects to the (functional) |
|---|
| 277 |
"Date::Calc" module (just "use Date::Calc::Object qw(...);" INSTEAD of |
|---|
| 278 |
"use Date::Calc qw(...);"), plus built-in operators like +,+=,++,-,-=,--, |
|---|
| 279 |
<=>,<,<=,>,>=,==,!=,cmp,lt,le,gt,ge,eq,ne,abs(),"" and true/false |
|---|
| 280 |
testing, as well as a number of other useful methods. |
|---|
| 281 |
|
|---|
| 282 |
The new modules "Date::Calendar::Year" and "Date::Calendar" allow you |
|---|
| 283 |
to create calendar objects (for a single year or arbitrary (dynamic) |
|---|
| 284 |
ranges of years, respectively) for different countries/states/locations/ |
|---|
| 285 |
companies/individuals which know about all local holidays, and which allow |
|---|
| 286 |
you to perform calculations based on work days (rather than just days), |
|---|
| 287 |
like calculating the difference between two dates in terms of work days, |
|---|
| 288 |
or adding/subtracting a number of work days to/from a date to yield a |
|---|
| 289 |
new date. The dates in the calendar are also tagged with their names, |
|---|
| 290 |
so that you can find out the name of a given day, or search for the |
|---|
| 291 |
date of a given holiday. |
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
Note to C developers: |
|---|
| 295 |
--------------------- |
|---|
| 296 |
|
|---|
| 297 |
Note again that the C library at the core of this module can also be |
|---|
| 298 |
used stand-alone (i.e., it contains no inter-dependencies whatsoever |
|---|
| 299 |
with Perl). |
|---|
| 300 |
|
|---|
| 301 |
The library itself consists of three files: "DateCalc.c", "DateCalc.h" |
|---|
| 302 |
and "ToolBox.h". |
|---|
| 303 |
|
|---|
| 304 |
Just compile "DateCalc.c" (which automatically includes "ToolBox.h") |
|---|
| 305 |
and link the resulting output file "DateCalc.o" with your application, |
|---|
| 306 |
which in turn should include "ToolBox.h" and "DateCalc.h" (in this order). |
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
Example applications: |
|---|
| 310 |
--------------------- |
|---|
| 311 |
|
|---|
| 312 |
Please refer to the file "EXAMPLES.txt" in this distribution for details |
|---|
| 313 |
about the example applications in the "examples" subdirectory. |
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
Tools: |
|---|
| 317 |
------ |
|---|
| 318 |
|
|---|
| 319 |
Please refer to the file "TOOLS.txt" in this distribution for details |
|---|
| 320 |
about the various tools to be found in the "tools" subdirectory. |
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
Credits: |
|---|
| 324 |
-------- |
|---|
| 325 |
|
|---|
| 326 |
Please refer to the file "CREDITS.txt" in this distribution for a list |
|---|
| 327 |
of contributors. |
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
Author's note: |
|---|
| 331 |
-------------- |
|---|
| 332 |
|
|---|
| 333 |
If you have any questions, suggestions or need any assistance, please |
|---|
| 334 |
let me know! |
|---|
| 335 |
|
|---|
| 336 |
Please do send feedback, this is essential for improving this module |
|---|
| 337 |
according to your needs! |
|---|
| 338 |
|
|---|
| 339 |
I hope you will find this module useful. Enjoy! |
|---|
| 340 |
|
|---|
| 341 |
Yours, |
|---|
| 342 |
-- |
|---|
| 343 |
Steffen Beyer <sb@engelschall.com> http://www.engelschall.com/u/sb/ |
|---|
| 344 |
"There is enough for the need of everyone in this world, but not |
|---|
| 345 |
for the greed of everyone." - Mohandas Karamchand "Mahatma" Gandhi |
|---|