Please, please, please don't encourage people to do this when there are perfectly good, well-maintained, well-tested date/time modules available to do the task. People copy-pasting or re-inventing their own date/time routines is an incredibly common source of bugs and maintenance nightmares. | [reply] |
Y’see? If you had logged-in, you would have accumulated 17 experience-points and counting.)
This is fundamentally excellent advice. If you “roll your own” solution to [any ...] “well-known Thing That Has Already Been Done™,” merely to avoid installing and useing a well-known CPAN module that does the entire task, then you have imposed an unnecessary maintenance burden upon the future maintainers of your code. (“Goody for you that you now work at Google, but I’m still here ...”) If you had used the CPAN tool, then your successors would not have to dumpster-dive into that piece of logic to be sure that you did it right to discover the subtle bug in your one-of-a-kind code. Instead, they could have relied upon the self-tests that the CPAN module includes, knowing that the module would not have been installed at all if any of those self-tests had failed.
Also: if you are maintaining a legacy code-base that did these things in a particular way, e.g. using a CPAN module that you really don’t like but that does do the job correctly, please “keep using that module.” Don’t unnecessarily introduce “two sources of Truth.”
| |