Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 71140
Status: new
Priority: 0/
Queue: Test-Harness

People
Owner: Nobody in particular
Requestors: daviddlowe.flimm [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Add option to keep parser results after running a parser
By default, it is very difficult to retrieve TAP::Parser::Result objects from a TAP::Parser object after it has iterated through the results in its run method. I propose adding a new boolean option to its constructor, labelled "store_results", which would default to false for efficiency. A new method named "results" would return the array of stored TAP::Parser::Result objects. A new accessor "store_results" should also be created. Example code: my $parser = TAP::Parser->new( { source => $source } ); $parser->store_results(1); $parser->run(); my @results = $parser->results(); Example use case: TAP::Harness::Archive (in another project) reads TAP output stored in a tarball, like this: my $aggregator = TAP::Harness::Archive->aggregator_from_archive({ archive => 'my_tests.tar.gz' } ); for my $description ($aggregate->descriptions) { my ($parser) = $aggregate->parsers($description); } It would be useful if one could retrieve TAP::Parser::Result objects, like this: my $aggregator = TAP::Harness::Archive->aggregator_from_archive({ archive => 'my_tests.tar.gz', made_parser_callback => sub { shift->store_results(1) }, }); for my $description ($aggregate->descriptions) { my ($parser) = $aggregate->parsers($description); my @results = $parser->results(); }