For your debugging pleasure, here is a debugger run for the io_pipe.t
test script
--------------------------------------------------------
C:\Documents and Settings\adam\Local
Settings\Temp\cpan\build\IO-1.22>perl -Ibli
b/arch -Iblib/lib -d t/io_pipe.t
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `perldoc perldebug' for more help.
main::(t/io_pipe.t:3): my $perl;
SetConsoleMode failed, LastError=|6| at
c:/vanilla-perl/perl/site/lib/Term/ReadK
ey.pm line 265.
at c:/vanilla-perl/perl/site/lib/Term/ReadLine/readline.pm line 1415
readline::readline(' DB<1> ') called at
c:/vanilla-perl/perl/site/lib/T
erm/ReadLine/Perl.pm line 11
Term::ReadLine::Perl::readline('Term::ReadLine::Perl=ARRAY(0xaf0b88)', '
DB<1> ') called at c:/vanilla-perl/perl/lib/perl5db.pl line 6367
DB::readline(' DB<1> ') called at
c:/vanilla-perl/perl/lib/perl5db.pl l
ine 2203
DB::DB called at t/io_pipe.t line 3
DB<1> n
main::(t/io_pipe.t:37): $| = 1;
DB<1> n
main::(t/io_pipe.t:38): print "1..10\n";
DB<1>
1..10
main::(t/io_pipe.t:40): $pipe = new IO::Pipe->reader($perl, '-e', 'print
"not ok
1\n"');
DB<1>
main::(t/io_pipe.t:41): while (<$pipe>) {
DB<1>
main::(t/io_pipe.t:45): $pipe->close or print "# \$!=$!\nnot ";
DB<1>
main::(t/io_pipe.t:46): print "ok 2\n";
DB<1>
ok 2
main::(t/io_pipe.t:48): $cmd = 'BEGIN{$SIG{ALRM} = sub {print "not ok
4\n"; exit
}; alarm 10} s/not //';
DB<1>
main::(t/io_pipe.t:49): $pipe = new IO::Pipe->writer($perl, '-pe', $cmd);
DB<1>
main::(t/io_pipe.t:50): print $pipe "not ok 3\n" ;
DB<1> syntax error at -e line 1, near "}continue"
Execution of -e aborted due to compilation errors.
main::(t/io_pipe.t:51): $pipe->close or print "# \$!=$!\nnot ";
DB<1>
# $!=Invalid argument
not main::(t/io_pipe.t:52): print "ok 4\n";
DB<1>
ok 4
main::(t/io_pipe.t:55): if ($^O eq 'os2' and
main::(t/io_pipe.t:56): system "$^X -I../lib -MOpcode -e 'defined
fork or di
e' > /dev/null 2>&1") {
DB<1>
main::(t/io_pipe.t:61): $pipe = new IO::Pipe;
DB<1>
main::(t/io_pipe.t:63): $pid = fork();
DB<1>
main::(t/io_pipe.t:65): if($pid)
main::(t/io_pipe.t:66): {
DB<1> ######### Forked, but do not know how to create a new TTY. #########
Since two debuggers fight for the same TTY, input is severely entangled.
I know how to switch the output to a different window in xterms
and OS/2 consoles only. For a manual switch, put the name of the
created TTY
in $DB::fork_TTY, or define a function DB::get_fork_TTY() returning this.
On UNIX-like systems one can get the name of a TTY for the given window
by typing tty, and disconnect the shell from TTY by sleep 1000000.
main::(t/io_pipe.t:65): if($pid)
main::(t/io_pipe.t:66): {
{pid=4752} DB<1>
main::(t/io_pipe.t:67): $pipe->writer;
DB<1>
main::(t/io_pipe.t:75): $pipe->reader;
{pid=4752} DB<1>
main::(t/io_pipe.t:68): print $pipe "Xk 5\n";
DB<1>
main::(t/io_pipe.t:76): $stdin = bless \*STDIN, "IO::Handle";
{pid=4752} DB<1>
main::(t/io_pipe.t:69): print $pipe "oY 6\n";
DB<1>
main::(t/io_pipe.t:77): $stdin->fdopen($pipe,"r");
{pid=4752} DB<1>
main::(t/io_pipe.t:70): $pipe->close;
DB<1>
main::(t/io_pipe.t:78): exec 'tr', 'YX', 'ko';
{pid=4752} DB<1>
main::(t/io_pipe.t:71): wait;
DB<1>
main::(t/io_pipe.t:85): $pipe = new IO::Pipe;
{pid=4752} DB<1>
main::(t/io_pipe.t:86): $pid = fork();
{pid=4752} DB<1>
main::(t/io_pipe.t:88): if($pid)
main::(t/io_pipe.t:89): {
{pid=4752} DB<1> ######### Forked, but do not know how to create a new
TTY. ###
######
Since two debuggers fight for the same TTY, input is severely entangled.
I know how to switch the output to a different window in xterms
and OS/2 consoles only. For a manual switch, put the name of the
created TTY
in $DB::fork_TTY, or define a function DB::get_fork_TTY() returning this.
On UNIX-like systems one can get the name of a TTY for the given window
by typing tty, and disconnect the shell from TTY by sleep 1000000.
main::(t/io_pipe.t:88): if($pid)
main::(t/io_pipe.t:89): {
{pid=4752} DB<1>
main::(t/io_pipe.t:90): $pipe->reader;
{pid=4752} DB<1>
main::(t/io_pipe.t:100): $pipe->writer;
{pid=4752} DB<1>
main::(t/io_pipe.t:91): while(<$pipe>) {
{pid=4752} DB<1>
main::(t/io_pipe.t:102): $stdout = bless \*STDOUT, "IO::Handle";
{pid=4752} DB<1>
main::(t/io_pipe.t:103): $stdout->fdopen($pipe,"w");
{pid=4752} DB<1>
main::(t/io_pipe.t:104): print STDOUT "not ok 7\n";
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1> main::(t/io_pipe.t:105): exec 'echo', 'not ok 8';
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:112): $pipe = new IO::Pipe;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:113): $pipe->writer;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:115): $SIG{'PIPE'} = 'broken_pipe';
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:121): print $pipe "not ok 9\n";
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:122): $pipe->close;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:124): sleep 1;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1> main::(t/io_pipe.t:126): print "ok 10\n";
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1>
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<1>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<1> x @_
empty array
{pid=4752} DB<2> x $_
0 "ok 7\cM\cM\cM\cM\cM\cM\cM\cM\cJ"
{pid=4752} DB<3> n
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<3>
main::(t/io_pipe.t:93): print;
{pid=4752} DB<3> x $_
0 "ok 10\cM\cM\cM\cJ"
{pid=4752} DB<4> n
main::(t/io_pipe.t:92): s/^not //;
{pid=4752} DB<4> x $_
0 "ok 7\cM\cM\cM\cM\cM\cM\cM\cM\cM\cJ"
{pid=4752} DB<5>
At which point you are into an infinite loop...