"Kjeld Flarup" <kjeld.flarup@liberalismen.dk> wrote in message
news:3e3bf34d$0$11060$edfadb0f@dread12.news.tele.dk...
> Jimmy wrote:
> > Jeg har kigget på Date::Manip, men forfatteren anbefaler at man bruger
et
> > andet modul, når man kun har brug for en simpel konvertering.
>
> Står der han anbefaler et andet modul? Tror du ikke nærmere det står at du
ikke
> skal bruge et modul overhovedet.
Du kan læse hans tekst på nedenfor:
http://www.perldoc.com/perl5.6.1/lib/Date/Manip.html
http://www.perldoc.com/perl5.6.1/lib/Date/Manip.html#SHOULD-I-USE-DATE--MANI
P
SHOULD I USE DATE::MANIP
If you look in CPAN, you'll find that there are a number of Date and Time
packages. Is Date::Manip the one you should be using? In my opinion, the
answer is no most of the time. This sounds odd coming from the author of the
software, but read on.
Date::Manip is written entirely in perl. It's the most powerful of the date
modules. It's also the biggest and slowest.
Since Date::Manip is written entirely in perl, and depends on no other
module not in a standard perl distribution, Date::Manip has no dependancies
to meet. Other modules have dependancies on a C compiler or other perl
modules. Since it is fairly easy to satisfy these dependancies for anyone
who is reasonably familiar with perl modules, this is not a huge advantage
that Date::Manip has.
On the other hand, simpler perl modules tend to be faster than Date::Manip,
and modules written in C are significantly faster than their perl
counterparts (at least if they're done right). The TimeDate and Time-modules
modules are written in perl, but are much simpler (and hence, faster) than
Date::Manip. The Date::Calc module is written in C and is a good module for
doing many date calculations much faster than Date::Manip. Between these
three, most of your common date operations can be done.
Date::Manip is certainly the most powerful of the Date modules. To the best
of my knowledge, it will do everything that any other date module will do
(not just the ones I listed above), and there are a number of features that
Date::Manip has that none of the other modules have. Date::Manip is the
"Swiss Army Knife" of Date modules. I'm trying to build a library which can
do _EVERY_ conceivable date/time manipulation that you'll run into in
everyday life.
Although I am working on making Date::Manip faster, it will never be as fast
as other modules. And before anyone asks, Date::Manip will never be
translated to C (at least by me). I write C because I have to. I write perl
because I like to. Date::Manip is something I do because it interests me,
not something I'm paid for.
Date::Manip is also big. The last time I looked, it's one of the largest
CPAN modules there is. If you ignore modules like Tk, LWP, etc. which are
actually packages of modules, it may be the largest. It's true that
Date::Manip will do almost every date operation you could imagine... but you
rarely need all that power. I'm working on reducing the footprint of
Date::Manip, but even at it's slimmest, it'll outweigh the other modules by
a good bit.
If you are going to be using the module in cases where performance is an
important factor (started up in a CGI program being run by your web server
5,000 times a second), you should check out one of the other Date or Time
modules in CPAN. If you're only doing fairly simple date operations (parsing
common date formats, finding the difference between two dates, etc.), the
other modules will almost certainly suffice. If you're doing one operation
very repetitively (parsing 10,000 dates from a database), you are probably
better off writing your own functions (perhaps bypassing all date modules
entirely) designed specifically for your needs.
On the other hand, if you want one solution for all your date needs, don't
need peak speed, or are trying to do more exotic date operations,
Date::Manip is for you. Operations on things like business dates, foreign
language dates, holidays and other recurring events, etc. are available
more-or-less exclusively in Date::Manip.
Mvh
Jimmy