Ok, going through all the replies now. I've started modifying
the code as per Dave's advice first, but I'm replying to this
one first =)
* Joshua Hoblitt ([EMAIL PROTECTED]) [21 Mar 2003 10:33]:
[...]
> You wrote that in a couple of hours???
I was in a programming mood. Other times, I'd write that over the
course of a week, just doing a bit here and a bit there.
[...]
> > The docs need work, it needs more tests, and it's missing some
> > features. (And the tests to test the missing features.)
> I'll try to work on this tonight.
Cool.
[...]
> > I admit I think I got a bit carried away. =)
> Yes, you did.
=)
> It looks like a great start.
Bit of a mess. Wrote it in the fashion of "Hmm. I need this now.
Hmm. Now I need this. Oh, and I need this."
> I still think that using the length as a hash key could lead to
> unexpected behavior.
> Consider:
> my $new_parser = DateTime::Format::Builder->create_parser(
> 8 => { ... }
> ...
> 8 => { ... }
> );
> Maybe this would be safer?
> {
> length => 8,
> params => [ qw( month day year ) ],
> regex => qr/^(\d\d)(\d\d)(\d\d\d\d)$/,
> zero => { hour => 0, minute => 0, second => 0 },
> },
And if there are multiple parsers for the same length, just chain them
together in the order of specification? Can do!
> Maybe I'm just paranoid...
Well, I was thinking of abolishing the hash style just so the
simple case doen't end up needing { } around it. Thus label
and length would be used rather than hash keys. Otherwise,
every time I introduce a new key to the spec, it could result
in things being mis-parsed as a spec rather than a hash of
specrefs.
create_parser() would be:
create_parser( spec );
or create_parser( specref+ );
> DateTime::Format::Builder->create_class(
> class => 'DateTime::Format::MySQL',
> This scares me. :) The namespace collisions could be spectacular.
Yep. Although my intent is to actually have the module be
targeted primarily at developers rather than end-users. As I
tend to do, I started with a simple case and a simple method,
when writing the code. Then I started expanding and making
support routines, and fa�ades to simplify matters. Which,
logically, lead to create_class(). Which, as the newest
routine, needs more work =)
[snip patch]
Thanks, applied =) [I've always wanted to say that]
> And maybe change 'Class' to 'Namespace' to be super clear
> about what is happening.
The doco will be significantly expanded =) That method will be
substantially modified too. I need to sit down and write some
modules and code that use the various methods so I have a good
feel of what's convenient.
cheers,
--
Iain.