Hello, I am writing a Finance::StockAccount set of modules to analyze the past transactions in a personal stock account. I hope to distribute this on CPAN. Dates are incidental to this: I need to be able to import transactions with dates and compare dates to sort chronologically. I want to make it easy to use my modules, including when importing dates or setting a date using a string.

There are plenty of CPAN modules related to dates, including parsing, comparing, and formatting for display. So there is no reason for me to reinvent the wheel here. So far, I am thinking of using DateTime, the choice appears to be simple and defensible, as it seems so standard, is so robust, and there is so much built around it. DateTime::Format::CLDR and DateTime::Format::Flexible look like relatively standard and easy ways to import dates from strings. So then some of my classes will have a "date" property like date => $dt. Others will have methods that sort transactions by date using the DateTime->compare method.

That's all fine for me. But is that fine for the people who might use my module? Is there a standard or recommended way to handle dates in CPAN modules? Is a dependency on DateTime okay? DateTime has a lot of dependencies itself. I see Time::Moment is lighter weight, should I worry about performance? Any other thoughts/suggestions?

Thanks very much for your help.

John


In reply to Which Module for Dates? by jrefior

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.