I needed to munge some data, and remove records that had a begin and end date that overlapped partially or completely with records I had already seen. I therefore asked CPAN what modules exist to deal with date intervals.
I immediately discovered Date::Interval. I had a bit of trouble downloading it, because I tried to download the Date-Interval distribution, which doesn't exist. A closer look revealed that the name of the distribution is "Interval".
I then installed it sucessfully, except that it failed when I tried to use it, because the distribution Makefile.PL neglects to mention that Date::Manip is a pre-requisite.
So I went and installed that, again stumbling over the fact that the name of the distribution is DateManip, and not, as I would have expected, Date-Manip. I know this is a really minor issue, but modules that cut "against the grain" like this interrupt what would otherwise be a smooth user experience.
(update: I should point out that I was using a package manager (ppm for ActivePerl on Win32) that deals with distributions only, not modules. Hence the problem).
At this point I had both Date::Interval and Date::Manip installed. When I tried to run my program, I received another error message
"ERROR: Date::Manip unable to determine TimeZone"
It was about here that my software hate meter began to move into the red zone. I know I will not be dealing with time zones, so why is it even bothering to check? It should defer that test until it actually needs to.
I gave up on Date::Interval at this point. I had two other niggling suspicions about whether this module would be useful. Firstly, the constructor doesn't offer a simple ($year, $month, $day) constructor. It has a magic date parser constructor, but I felt it was a bit silly to sprintf up a date string just so that it could parse it.
Also, I am unsure that I'd be able to stick a series of dates into a Date::Interval object, and then see if a new date interval hits any of the existing intervals. I have the feeling that one has to maintain an array of Date::Interval objects, and then loop through it to see whether a new interval touches any of them. Which seems to be more make-work code that I care to write.
I shall now have a look at DateTime-Set.
4 out of 7 found this review helpful. Was this review helpful to you? Yes No