stas 2004/03/01 14:18:18
Modified: t/modperl request_rec_perlio_api.t t/response/TestModperl request_rec_perlio_api.pm Log: as of perl 5.8.3 in-memory-filehandles have problems with STD streams and threads. A sequence: % t/TEST -v t/modperl/request_rec_perlio_api.t \ t/modperl/io_nested_with_closed_stds.t was failing because of the warning in the latter test: Filehandle STDOUT reopened as STDIN only for input at /home/stas/apache.org/modperl-2.0/t/response/TestModperl/io_nested_with_closed_stds.pm line 54. This is because PerlIO_stdin() wasn't getting restored after the in-memory-filehandle was used and had it fileno stuck at that in-memory-filehandle that has gone out of scope. Solution: use a plain file to reopen STDIN Revision Changes Path 1.3 +1 -1 modperl-2.0/t/modperl/request_rec_perlio_api.t Index: request_rec_perlio_api.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/modperl/request_rec_perlio_api.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- request_rec_perlio_api.t 15 Oct 2003 08:06:03 -0000 1.2 +++ request_rec_perlio_api.t 1 Mar 2004 22:18:17 -0000 1.3 @@ -16,7 +16,7 @@ { my $content = join "", 'a'..'j', 'k'..'t'; my $location = "$uri?STDIN"; - my $expected = join "", 'a'..'j', "<samba>", 'k'..'t'; + my $expected = join "", 'a'..'j', "package", 'k'..'t'; my $received = POST_BODY_ASSERT $location, content => $content; ok t_cmp($expected, $received, "STDIN tests"); } 1.3 +2 -6 modperl-2.0/t/response/TestModperl/request_rec_perlio_api.pm Index: request_rec_perlio_api.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestModperl/request_rec_perlio_api.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- request_rec_perlio_api.pm 15 Oct 2003 08:08:52 -0000 1.2 +++ request_rec_perlio_api.pm 1 Mar 2004 22:18:17 -0000 1.3 @@ -38,14 +38,10 @@ # lose any chars when we restore it to the POST stream open my $stdin, "<&STDIN" or die "Can't dup STDIN: $!"; - # at this occasion, let's test in memory files feature - # (new in 5.8.0) - my $in_mem_file = "<samba>"; - close STDIN; - open STDIN, "<", \$in_mem_file + open STDIN, "<", __FILE__ or die "failed to open STDIN as 'in memory' file : $!"; my $data; - read STDIN, $data, length $in_mem_file; + read STDIN, $data, length("package"); print STDOUT $data; close STDIN;