Hi all,
I've been banging my head for quite a while on a bad file descriptor problem.
Basically, I have TAPx::Parser 0.12
(http://users.easystreet.com/ovid/downloads/TAPx-Parser-0.12.tar.gz) in
development and I have tried to clean up the 'tprove' script by adding
TAPx::Parser::Source::Perl. That package basically tries to execute some perl
code and return a stream:
use TAPx::Parser::Source::Perl;
my $source = TAPx::Parser::Source::Perl->new;
my $file = 't/00-load.t';
my $stream = $source->filename($file)->get_stream;
while ( defined( my $line = $stream->next ) ) {
print "$line\n";
}
It executes the code with the following:
sub get_stream {
my ( $self ) = @_;
my $command = $self->_get_command;
local *FH;
# -| is safer, but not portable.
if ( open FH, "$command |" ) {
return TAPx::Parser::Iterator->new(\*FH);
}
else {
$self->error("Could not execute ($command): $!");
return;
}
}
However, whenever I try to run it, I get this error message:
Can't dup STDOUT: Bad file descriptor at
/usr/local/lib/perl5/5.8.7/Test/Builder.pm line 1322.
I am autoflushing STDERR and STDOUT in new(), but now I'm stumped. Any
suggestions? If you download the tarball, you'll find that examples/tprove has
the old code and examples/tprove2 has the new code.
Cheers,
Ovid
-- If this message is a response to a question on a mailing list, please send
follow up questions to the list.
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/