in reply to Re: Ovid's "Please Stop Using Perl 3"
in thread Ovid's "Please Stop Using Perl 3"

perl-DateManip is in basically every distro. and I still see code avoiding it.

That's because it's horrible. Even the author doesn't recommend that you use it:

Is Date::Manip the one you should be using? In my opinion, the answer is no most of the time. (Should I Use Date::Manip?)

Please get into the habit of recommending DateTime.pm and its friends. That's the best way to handle dates and times in Perl.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re^2: Ovid's "Please Stop Using Perl 3"

Replies are listed 'Best First'.
Re^3: Ovid's "Please Stop Using Perl 3"
by nevyn (Monk) on Sep 07, 2006 at 17:08 UTC
    From the same page:
    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.

    This is the reason I recommend it, the speed is rarely a factor (for what I do, YMMV). The API that I use in 99% of cases is 2-3 functions.

    Also AFAICS if you have a "Date and time" as a string there is no DateTime constructor to pass it to Date::Manip::ParseDate "just works". Getting a readable version of the data out also seems much harder than calling Date::Manip::UnixDate too.

    But all of this just proves my other point, if you want an answer to the question "Which module should I use to do X" you can't easily get an answer ... you have to either pick a module and hope, or hack some code in directly that you know/think solves your problem.

    --
    And-httpd, $2,000 security guarantee
    James Antill
      Also AFAICS if you have a "Date and time" as a string there is no DateTime constructor to pass it to. Date::Manip::ParseDate "just works".

      The point is that DateTime is a family of modules. To do extra stuff, you install the appropriate module. In this case you want DateTime::Format::DateParse.

      But all of this just proves my other point, if you want an answer to the question "Which module should I use to do X" you can't easily get an answer ... you have to either pick a module and hope, or hack some code in directly that you know/think solves your problem.

      The Perl DateTime project was set up to address exactly that problem (well, at least, in this one area). Sounds like they may as well have not wasted their time if people like you are just going to ignore their work.

      --
      <http://dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg