Making a source
Steve Purkis
steve at purkis.ca
Wed Jun 25 22:59:18 UTC 2008
Hi Andy,
On Jun 25, 2008, at 23:41, Andy Armstrong wrote:
> So how do we now create a stream that's based on TAP::Parser::Source
> to pass to the TAP::Parser constructor? TAP::Parser::Source needs a
> parser arg - so you can't create one /before/ creating the parser.
Yeah.. chicken, meet egg.
> And, hey, I wouldn't complain but it's totally pooped on my test
> harness at work :)
>
> In general the problem is that the TAP::Parser is the factory for
> everything else - so it's hard to make anything else without having
> already created the parser. I would have thought that we should
> instead have the factory as a distinct object, no?
Agreed... I've been moving towards instantiable factories with baby
steps. The groundwork's all in place, but I've not had time to move
away from T::P having a 'result_factory_class' to a
'result_factory'. heck, I suppose it could have both.
Also, (slightly OT) I was thinking of going OTT and introducing a
SourceFactory. This is so you could have Source::Perl,
Source::Python, Source::PHP, Source::YerMom, etc. The current source
could move to Source::Shell (or ::Command). I don't know how silly
that is, it's 7 to midnight after all, but the idea was to make it
really easy to extend sources.
Finally, (more OnT) I had the pleasure of realizing today that
there's no easy way to tell TAP::Harness about all this nifty
subclassing mumbo jumbo. You have to get stuck in, and create your
own subclass of T::H if you want a custom Perl source. That should
probably change too.
-Steve
More information about the tapx-dev
mailing list