[Bps-public-commit] r18614 - in HTTP-Server-Simple: .

jesse at bestpractical.com jesse at bestpractical.com
Mon Mar 2 18:15:26 EST 2009


Author: jesse
Date: Mon Mar  2 18:15:25 2009
New Revision: 18614

Modified:
   HTTP-Server-Simple/   (props changed)
   HTTP-Server-Simple/Changes
   HTTP-Server-Simple/lib/HTTP/Server/Simple.pm

Log:
 r59862 at 17h:  jesse | 2009-03-02 18:13:49 -0500
 *  patch from confound++ for http://rt.cpan.org/Public/Bug/Display.html?id=28122


Modified: HTTP-Server-Simple/Changes
==============================================================================
--- HTTP-Server-Simple/Changes	(original)
+++ HTTP-Server-Simple/Changes	Mon Mar  2 18:15:25 2009
@@ -1,3 +1,7 @@
+0.38_01 Mon Mar  2 18:11:46 EST 2009
+* http://rt.cpan.org/Ticket/Attachment/568795/286902/ from confound++ for 
+  http://rt.cpan.org/Public/Bug/Display.html?id=28122
+
 0.38 Sun Jan 11 14:42:57 EST 2009
 
 * Improve startup banner generation

Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple.pm	(original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple.pm	Mon Mar  2 18:15:25 2009
@@ -8,7 +8,7 @@
 use URI::Escape;
 
 use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.38';
+$VERSION = '0.38_01';
 
 =head1 NAME
 
@@ -206,15 +206,25 @@
 
 sub background {
     my $self  = shift;
+    require File::Temp;
+    my ($fh, $filename) = File::Temp::tempfile();
+    unlink($filename);
     my $child = fork;
     croak "Can't fork: $!" unless defined($child);
-    return $child if $child;
+    if ($child) {
+        while (eof($fh)) {
+            select(undef, undef, undef, 0.1);
+            seek($fh, 0, 0);
+        }
+        return $child;
+    }
 
     if ( $^O !~ /MSWin32/ ) {
         require POSIX;
         POSIX::setsid()
             or croak "Can't start a new session: $!";
     }
+    $self->{after_setup} = sub { print {$fh} 1; close $fh };
     $self->run(@_);
 }
 
@@ -660,7 +670,7 @@
         )
         or croak "bind to @{[$self->host||'*']}:@{[$self->port]}: $!";
     listen( HTTPDaemon, SOMAXCONN ) or croak "listen: $!";
-
+    $self->{after_setup} && $self->{after_setup}->();
 }
 
 



More information about the Bps-public-commit mailing list