----- Original Message ----
> From: Ovid <[EMAIL PROTECTED]>
>
> 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.

After struggling with this for over an hour, I think I finally found the 
problem.  If I *don't* localize the filehandle, this problem goes away.  
Apparently, localizing that typeglob caused the underlying descriptor to 
disappear once the localized typeglob went out of scope.  I wondered why the 
FILE typeglob in Test::Harness::Straps::analyze_file() wasn't localized and now 
I know.  A comment in there might be useful.

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/







Reply via email to