On Thu, 20 Mar 2003, Iain 'Spoon' Truskett wrote:

> > I'm wondering if maybe we need a DateTime::Format::Custom or maybe
> > just a DateTime::Format as a base class ? That you give a
> > DateTime::Format::ICal::valid_formats style definition too.
>
> DateTime::Format::(Builder|Generic|Factory) (I forget what the
> patterns folk are into these days)

I think it'd be Builder, since what it should probably do is construct
methods for you based on a spec.

> > my $custom_parser = DateTime::Format::Custom->format(
> >       15 => {
> >               params => [ qw( year month day hour minute second ) ],
> >               regex  => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/,
> >               zero   => {},
> >       },
> >       ...
> > );
>
> Not sure I'd have the '15' bit there. Or is that to let it try
> multiple parses?

The 15 is the string length.  In this example, taken from the iCal format
module, it checks the string length and parses based on that, since there
are several valid iCal formats each of which is distinguishable based on
length.

I think what struck Joshua was the extreme similarity between this, the
MySQL, and the W3CDTF module.

If someone wants to work on a Builder module, that's fine with me.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to