> Ok. As I've currently got it: > > - $class->create_parser(...) > > This creates a parser coderef. Straight forward so far. > Now, the parameters make it more fun: > > If given a hash: > > create_parser( params => \%params, regex => qr// ); > > Then we assume it's a single format parser. I'll call these > arguments a 'spec' from now on. A hashref of these params is, > of course, a specref. > > If given a specref as first argument, we assume it's a list of > specrefs, which will be tried in the order given. > > If given a hash of number => specref, for example: > > create_parser( 15 => \%ical15, 8 => \%ical8, ... ); > > Then a length mapping parser, like in DT::F::MySQL and DTF'ICal, > is created. > > If the 'number' part isn't actually a number, i.e. label => > specref, then the labels are sorted and the parser function > goes through in that order.
<evil> And maybe a hook for a callback to determine if the 'spec' is a match? </evil> What about mixed numeric and string specrefs? Maybe it would be better to specify an optional match length inside the specref and just make the hash anonymous. > I intend to do a code release within a few hours. It won't necessarily > be complete, but it should be enough to be disparaged. My offset is -1000 so you'll have to wait until morning to be disparaged (by me). Cheers, -J