New API for DateTime formats.

[email protected] (Evan Carroll)
Newsgroups perl.datetime
Message-ID <[email protected]>
I've creating a new API for DateTime formats using a system of Moose::Role -s.
These greatly eliminate code redundancy and help consistency. Some of
the advantages:

* We can now support Time from formats in a consistent fashion
* We can now overload any piece of the environment Locale/Timezone in
a specific call to parse_datetime
* We can now ensure builders of Formats provide the same api
(debug/defaults/locale/timezone/pattern) etc.
* We can now ensure consistency in the debugging information across all Formats
* Using MooseX::Types::DateTime we can now coerce to Timezones/Locales
from strings in an intelligent fashion consistently
* We can remove the duplication of Olsen abbreviations -> ambiguous
exception handlers by putting all of the code in one place.
* We can provide the mechanisms necessary to adapt ::Format::* to
Time-specific (dateless DateTime modules) by providing intelligent
defaults, and wrapping the call to DateTime->new with a helper
* We can disable the defaults (setting times to 0, dates to 1)
* We provide the ability to cache Locale/Timezone creation across the board.

Really it boils down to having two subs required, parse_datetime {},
and format_datetime {}, and nothing else.

There are a few more major points I'm probably still missing.

TODO: make work for 5.8, make a DateTimeX::Format::Migration to
further help those that wish to use DateTimeX::Format without any
code-additions (just deletions)

All input is appreciated

-- 
Evan Carroll
System Lord of the Internets
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.