If this is on the CPAN, please let me know. I can't find it. If not, we probably need it at work
The W3C duration standard, derived from the ISO 8601 duration standard, allows one to specify durations in a format like PnYnMnDTnHnMnS (e.g.: "P1Y2MT2H", a duration of one year, two months and two hours). I can't find a proper parser for it and it turns out to have some tricky bits. Basically, I want to do this:
my $duration = DateTime::Duration::W3C->new_from_w3c("P1Y2MT2H");
Which would be more or less equivalent to:
my $duration = DateTime::Duration->new(
years => 1,
months => 2,
hours => 2,
The only real difference would be (I think) adding string overloading to allow one to print the duration and have it come out in the proper format.
I can write this and try to handle the special cases I find documented (I'll be damned if I'm going to pay 130 Swiss Francs for the damned ISO 8601 standard), but I'd love to know if it's already out there.