Perl's not the only TAP source
David E. Wheeler
david at kineticode.com
Sat Jun 20 20:00:47 GMT 2009
On Jun 20, 2009, at 6:21 AM, Andy Armstrong wrote:
> I'm not what else there is to make pluggable apart from formatting and
> source handlers - but I'm open to suggestions.
The only other thing we discussed was parsers for other test formats.
And I agree that they should be external. This is TAP::Parser, after
all.
> Yeah, I think that's right; a source should be an iterator.
I disagree, that's a separate behavior. It's dead simple for the
source to return an iterator as in my PHP example, which I present
here again just as a reminder. Well, I'll treat the passed argument as
an object this time:
package TAP::Parser::Source::PHP;
use strict;
our $VERSION = '3.18';
sub can_handle {
my $meta = shift;
return 0 unless $meta->is_file;
return 1 if $meta->file{lc_ext} eq '.php';
return 0;
}
sub command {
my $meta = shift;
return [ 'php', $meta->file{name} $meta->config ];
}
The only trick here is to pass an object with the config only for the
PHP source.
> Simplify! Unless we can come up with a good reason why the iterators
> are distinct from sources they should go.
Oh, they're distinct. I don't think we need the factor, although it
doesn't seem to hurt. But a source is responsible for saying if it can
handle a source and for creating an iterator. In that sense, perhaps
they're best called SourceDetectors, in all honesty.
>> Now the bad news as for when I'll be free... I've got an exam to
>> prep for in a week and a half, so hopefully after that.
>
> Hmm. I wonder if I shouldn't have merged sourcedetector into master
> then. I'd like to be able to make a release of 3.18 if the need
> arises. Thoughts?
I thought it was a bit soon, to be honest.
Best,
David
More information about the tapx-dev
mailing list