Thanks for the feedback, I've replied inline below. Please let me know if you have any other questions or suggestions.

On Jul 27, 2008, at 4:12 PM, Dave Rolsky wrote:

On Sun, 27 Jul 2008, Flavio S. Glock wrote:

re:
http://search.cpan.org/dist/DateTime-Format-Span/

This module seems to handle durations, instead of spans.

A duration is span of time no? This module uses 'span' to mean 'the duration of time spanning 2 points in time' (plus ::Duration was taken)

How about naming it DateTime::Format::Duration instead?

Well, such a module already exists!

Daniel, Flavio raises a good point, though. What is the point of your module, and how is it different from DT::F::Duration?

I actually looked at ::Duration and a number of other formatting modules before deciding on making this one, for a number of reasons.

::Duration is essentially a fancy sprintf which puts the localization logic back on the coder. Its idea is 'make a sprintf format that you can pass different durations through.

You can do the exact same thing with $dt->strftime() really (sans the parsing the output back into to create an object which I'm not at all concerned with since its for output only)

In other words this:

$dt->strftime('%Y years, %m months, %e days, %H hours, %M minutes, %S seconds');

is the exact same thing as the first example in ::Durations's POD.

The real difference is that it is simply not how a human would say it.

For example from ::Duration's POD regarding its output:
3 years, 5 months, 1 days, 6 hours, 15 minutes, 45 seconds
  For English:
     a) '1 days' should be '1 day'
b) 45 seconds should be 'and 45 seconds' (keeping the oxford comma)

In my original draft I sent to Dave, when it was not under DateTime::Format like it should have been, I had this in an FAQ, I should probably add it back,
Why didn't you just use 'DateTime::Format::Duration'

Essencially it is a strftime for a Duration. This is not flexible enough for the intent of this module.

DateTime::Format::Duration is not a bad module its just for a different purpose

It was not localizable
You either got '2 days' or '1 days' which a) forces it to be in English and b) doesn't even make sense in English.

You could get around that by adding logic each time you wanted to call it but that is just messy.

Had to keep an item even if it was zero
If 'days' was in there you got '0 days', we only want items with a value to show.

That'd also require a lot of logic each time you wanted to call which is again messy.

As far as localization, I'd prefer to see locale-specific data as part of the DateTime::Locale module itself. In fact, CLDR 1.6 does include a bunch of stuff for formatting spans in a locale-specific way. I haven't integrated that into DT::Locale yet, because I want to figure out how to actually use it.

That'd be great! The way I did this for now was that ::Span::Locale determined what locale to use based on the datetime object's and/or args then loads Span::Locale::XX if possible and uses the data it defines.

Reply via email to