Default setup dont redirect STDERR
Christian Hansen [Mon, 17 Oct 2005 00:23:20 +0000 (00:23 +0000)]
examples/daemon.pl
lib/HTTP/Request/AsCGI.pm
t/04io.t
t/05env.t

index 9a040e3..11a51d6 100644 (file)
@@ -41,7 +41,7 @@ while ( my $client = $server->accept ) {
         $c->restore;
 
         my $response = $c->response;
-        
+
         # to prevent blocking problems in single threaded daemon.
         $response->header( Connection => 'close' );
 
index 42822c7..be0bece 100644 (file)
@@ -21,8 +21,7 @@ sub new {
         restored => 0,
         setuped  => 0,
         stdin    => IO::File->new_tmpfile,
-        stdout   => IO::File->new_tmpfile,
-        stderr   => IO::File->new_tmpfile
+        stdout   => IO::File->new_tmpfile
     };
 
     $self->{enviroment} = {
@@ -68,8 +67,8 @@ sub setup {
     open( STDIN, '<&=', $self->stdin->fileno )
       or croak("Can't open stdin: $!");
 
-    binmode( $self->stdin, ':raw' );
-    binmode( STDIN, ':raw' );
+    binmode( $self->stdin );
+    binmode( STDIN );
 
     if ( $self->request->content_length ) {
 
@@ -87,8 +86,8 @@ sub setup {
         open( STDOUT, '>&=', $self->stdout->fileno )
           or croak("Can't open stdout: $!");
 
-        binmode( $self->stdout, ':raw' );
-        binmode( STDOUT, ':raw' );
+        binmode( $self->stdout );
+        binmode( STDOUT);
     }
 
     if ( $self->stderr ) {
@@ -98,8 +97,8 @@ sub setup {
         open( STDERR, '>&=', $self->stderr->fileno )
           or croak("Can't open stderr: $!");
 
-        binmode( $self->stderr, ':raw' );
-        binmode( STDERR, ':raw' );
+        binmode( $self->stderr );
+        binmode( STDERR );
     }
 
     {
@@ -268,6 +267,10 @@ HTTP::Request::AsCGI - Setup a CGI enviroment from a HTTP::Request
 
 =head1 BUGS
 
+=item THANKS TO
+
+Thomas L. Shinnick for his valuable win32 testing.
+
 =head1 AUTHOR
 
 Christian Hansen, C<ch@ngmedia.com>
index e5c4539..029c5a7 100644 (file)
--- a/t/04io.t
+++ b/t/04io.t
@@ -5,6 +5,7 @@ use Test::More tests => 3;
 use strict;
 use warnings;
 
+use IO::File;
 use HTTP::Request;
 use HTTP::Request::AsCGI;
 
@@ -13,7 +14,9 @@ $r->content('STDIN');
 $r->content_length(5);
 $r->content_type('text/plain');
 
-my $c = HTTP::Request::AsCGI->new($r)->setup;
+my $c = HTTP::Request::AsCGI->new($r);
+$c->stderr(IO::File->new_tmpfile);
+$c->setup;
 
 print STDOUT 'STDOUT';
 print STDERR 'STDERR';
index c5c5351..c21c5cb 100644 (file)
--- a/t/05env.t
+++ b/t/05env.t
@@ -12,7 +12,6 @@ use HTTP::Request::AsCGI;
 my $r = HTTP::Request->new( GET => 'http://www.host.com/my/path/?a=1&b=2' );
 my $c = HTTP::Request::AsCGI->new($r);
 $c->stdout(undef);
-$c->stderr(undef);
 
 $c->setup;