From: Graciliano M. P. \(V. Sites\) <gm...@vi...> - 2002-09-30 02:04:58
|
I was looking for I/O redirection of a process for Wx. I saw in the wxPerl demo something for that, but doen't work! I got this alert on reading the HANDLE: readline() on unopened filehandle o at F:/CVS/wxPerl/wxPerl/demo/wxProcess.pm li ne 152 (+-) I'm using Win2K, Perl580 and wxPerl-0.11-wx233. I made another script to test this: --------------- testwxio.pl --------------- #!/usr/bin/perl use Wx ; package MyApp ; use vars qw(@ISA); @ISA = qw(Wx::App); sub new { my $class = shift; my $this = $class->SUPER::new(); return $this; } sub OnInit { 1 } package main ; my $app = MyApp->new() ; my $process = Wx::Process->new( $app , -1 ); $process->Redirect ; Wx::ExecuteArgs( [$^X, "test3.pl"], 1 , $process ); # Wx::ExecuteCommand( "$^X test3.pl" , 1 , undef ) ; my $stream = $process->GetInputStream ; while( 1 ) { sysread($stream , $buffer , 1) ; print "<$buffer>\n" ; sleep(1); } exit; --------------- test3.pl --------------- #!/usr/bin/perl for(0..2) { print "$_\n" ; sleep(1); } print STDERR "ERROR!!!! \n" ; exit; |