Date parse in perl

Christoph Biedl cbiedl at gmx.de
Mon Apr 19 18:51:37 UTC 2004


bill davidsen wrote...

> Is there a good date parse in perl which will handle all legal datas
> found in news?

None that I was aware of. Years ago I've enhanced HTTP::Date to do that
job and it does it quite well. However it's Dontask-ware[*].

> I could rewrite the parse from innd, but I'd rather save time on this
> project if I can.

Writing a parser from scratch is quite a difficult task. You can find a
lot of funny Date: formats in the wild and you'd have to take care of them
all. Ambiguity cannot be avoided, e.g. time zone EST (America and also
Australia Estern Standard Time).
Things would be a lot easier if RfC 1036 had restricted Date: to one
format like time_t or e.g. exactly '%Y-%m-%d %H:%M:%S %z', optionally a
more human readable string in (), but perhaps this was not possible to
enforce any more even back in 1987. It might comfort you that things are
_much_ worse in mail where Date: is not essential and needn't be parsed
during transport.

Back to your problem:
Today I'd rather spend the time to understand the mechanisms of how to
embed C modules in Perl modules in order to reuse lib/parsedate.c. This
would also ensure that this module behaves exactly like INN. Any
volunteers?

	Christoph

[*] Don't ask any questions like where, how or why. It works and I didn't
    take a single look into it for almost three years.



More information about the inn-workers mailing list