Because it's not part of the standard perl distribution and
I'd like to be able to distribute my code to people who
don't know how/don't want to be bothered to install stuff
off CPAN?
Because
my $seconds_per_day = 60 * 60 * 24;
my $then = time - (14 * seconds_per_day);
is, to me, at least as readable as
ehdonhon's
example
of using Add_Delta_YMD and doesn't pollute the namespace
either?
Granted, the $seconds_per_day version takes a
little extra work (remembering which indexes from
(localtime($then)) you want and adding offsets
to the extracted month and year if you intend to display
them directly), but it's worthwhile to have more easily
portable code, IMHO.
For a larger project that's likely to
need other modules, sure, Date::Calc is great. But if it's
the only non-core module that would be used, I don't think
it's worth the hassle of making people install it when you
can do the same thing using only the core language with so
little extra effort.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.