[Rt-commit] r6225 - in HTTP-Server-Simple: . lib/HTTP/Server/Simple lib/HTTP/Server/Simple/CGI t

jesse at bestpractical.com jesse at bestpractical.com
Wed Oct 18 23:37:29 EDT 2006


Author: jesse
Date: Wed Oct 18 23:37:27 2006
New Revision: 6225

Modified:
   HTTP-Server-Simple/   (props changed)
   HTTP-Server-Simple/Changes
   HTTP-Server-Simple/META.yml
   HTTP-Server-Simple/SIGNATURE
   HTTP-Server-Simple/lib/HTTP/Server/Simple.pm
   HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm
   HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
   HTTP-Server-Simple/t/01live.t
   HTTP-Server-Simple/t/03podcoverage.t
   HTTP-Server-Simple/t/04cgi.t

Log:
 r28915 at pinglin:  jesse | 2006-10-18 23:33:54 -0400
  * 0.21 - 5.004 support from Sébastien Aperghis-Tramoni 


Modified: HTTP-Server-Simple/Changes
==============================================================================
--- HTTP-Server-Simple/Changes	(original)
+++ HTTP-Server-Simple/Changes	Wed Oct 18 23:37:27 2006
@@ -1,4 +1,9 @@
 
+0.21 Wed Oct 18 23:31:42 EDT 2006
+   [rt.cpan.org #21727] [PATCH] Support for Perl 5.004
+    -- Sébastien Aperghis-Tramoni 
+
+
 0.19
 
   Catch and ignore SIGPIPE, so broken pipes from the client don't cause 

Modified: HTTP-Server-Simple/META.yml
==============================================================================
--- HTTP-Server-Simple/META.yml	(original)
+++ HTTP-Server-Simple/META.yml	Wed Oct 18 23:37:27 2006
@@ -1,5 +1,5 @@
 distribution_type: module
-generated_by: Module::Install version 0.63
+generated_by: Module::Install version 0.64
 license: perl
 name: HTTP-Server-Simple
 no_index: 
@@ -10,4 +10,4 @@
   CGI: 0
   Socket: 0
   Test::More: 0
-version: 0.19
+version: 0.21

Modified: HTTP-Server-Simple/SIGNATURE
==============================================================================
--- HTTP-Server-Simple/SIGNATURE	(original)
+++ HTTP-Server-Simple/SIGNATURE	Wed Oct 18 23:37:27 2006
@@ -14,32 +14,32 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 51733cb90c63ff78f2b240a8daee74300c28de6f Changes
+SHA1 147c8e418fc85106b56b53fdff25df6faed3edad Changes
 SHA1 0ac508c50476dcc2bf8fe3094cb341425291e1ee MANIFEST
-SHA1 9df9a468f970dd286ef72b010842afb1017f9324 META.yml
+SHA1 9aeff4bfa6bf2936d4c407b5db5d909931bc646f META.yml
 SHA1 490f3fd115e09cb05b725580e5ed5cdd58241049 Makefile.PL
 SHA1 ed0c107672daac3bc9e266876666e1059dbe44b7 README
 SHA1 4ea1e9072ca87399184a46233df52a21e285604d ex/sample_server
-SHA1 e28cf2d3ba35f6ca3a448acc7bee191b7c390379 inc/Module/Install.pm
-SHA1 e7c1c86f57b6778f4bdc7fd8c1b950e60ef41bc0 inc/Module/Install/Base.pm
-SHA1 e1829448769445cdaac384a888bf9ccf42e0d89a inc/Module/Install/Can.pm
-SHA1 70aa5e2055e8e38b4eecc5fc8c91762c0e97f551 inc/Module/Install/Fetch.pm
-SHA1 8ac832baf4f9e8e72d3e8f103cee6e8a94ac80e1 inc/Module/Install/Makefile.pm
-SHA1 0807e79d6dbfda4fcd3db0fc7df2e33e0cba263b inc/Module/Install/Metadata.pm
-SHA1 4da0a1fce2339cc3f8c296c7716480d2564d9470 inc/Module/Install/Win32.pm
-SHA1 9a903a1d178954ad864c7dcc98f9fa5c005d1553 inc/Module/Install/WriteAll.pm
-SHA1 b139883aeec8fc0d1a17261164daf2a1be784a60 lib/HTTP/Server/Simple.pm
-SHA1 2d7348b166f654a460ddae4cb4183f4a544c85fc lib/HTTP/Server/Simple/CGI.pm
-SHA1 27c4b8c97f00d3427a320c8087e2b77b128a1992 lib/HTTP/Server/Simple/CGI/Environment.pm
+SHA1 9b2f9d83bcf77860f53a0c07c90a4a59ad9f5df1 inc/Module/Install.pm
+SHA1 abe32855d75ab13747cf65765af9947b7a8c3057 inc/Module/Install/Base.pm
+SHA1 95b81d1e91bd634467bf633571eff4420e9c04eb inc/Module/Install/Can.pm
+SHA1 1fe98c63cf9d7271c8cb4183ba230f152df69e26 inc/Module/Install/Fetch.pm
+SHA1 2249171a2b72cd73ff2c0a06597d29f86e5df456 inc/Module/Install/Makefile.pm
+SHA1 381bb98ea3877bba49ae85e7a7ea130645fd3dbf inc/Module/Install/Metadata.pm
+SHA1 0c2118868ef82ac517eb6d9c3bd93e6eb9bbf83e inc/Module/Install/Win32.pm
+SHA1 e827d6d43771032fa3df35c0ad5e5698d0e54cda inc/Module/Install/WriteAll.pm
+SHA1 2b5884e8e86c79d78523d01bc6d1840e55d4d158 lib/HTTP/Server/Simple.pm
+SHA1 40f24374f2b5845a3025e14ca4b91bd58298de03 lib/HTTP/Server/Simple/CGI.pm
+SHA1 d35644a882953f699442654299cac16fa158b502 lib/HTTP/Server/Simple/CGI/Environment.pm
 SHA1 db064af54cab345a71daec576e32e64b8fb1033d t/00smoke.t
-SHA1 9e68bffc26b5a42e2785ec68c3bf6fe45d6bb6da t/01live.t
+SHA1 b64150ac4ebc772f8b1f69455039e7ea3e067b3f t/01live.t
 SHA1 aca95653cfce68912e08c57b3a4566207e2f99b3 t/02pod.t
-SHA1 90f0be3e6b0fab021155953742f5cc5c5e47a5aa t/03podcoverage.t
-SHA1 0ca7d32c396129b38a33a8077171b84076feb8d9 t/04cgi.t
+SHA1 a7024d0d8e7b80d26f75a3551a1406a797b382f8 t/03podcoverage.t
+SHA1 bbf511880e77fef4a252ed84438075cbb77924e4 t/04cgi.t
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (Darwin)
 
-iD8DBQFEkWmyEi9d9xCOQEYRAmmoAKCA6RHTxab01NdvkfvsHBnj8kLbfwCfWOS7
-NrOuVXMr09xE3cCxeLmZJFs=
-=4JaR
+iD8DBQFFNvIREi9d9xCOQEYRAoDXAJ9L1UXpDhayxHEIiniQUrvkFFwjqQCgwfgq
+JP64arGcMfMwC2DFawLZdcE=
+=kbaC
 -----END PGP SIGNATURE-----

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	Wed Oct 18 23:37:27 2006
@@ -1,16 +1,18 @@
 package HTTP::Server::Simple;
-use 5.006;
 use strict;
 use warnings;
+use FileHandle;
 use Socket;
 use Carp;
 use URI::Escape;
 
-our $VERSION = '0.20';
+use vars qw($VERSION $bad_request_doc);
+$VERSION = '0.21';
+
 
 =head1 NAME
 
-HTTP::Server::Simple
+HTTP::Server::Simple - Lightweight HTTP server
 
 
 =head1 SYNOPSIS
@@ -254,7 +256,7 @@
             local $SIG{PIPE} = 'IGNORE';    # If we don't ignore SIGPIPE, a
                  # client closing the connection before we
                  # finish sending will cause the server to exit
-            while ( accept( my $remote, HTTPDaemon ) ) {
+            while ( accept( my $remote = new FileHandle, HTTPDaemon ) ) {
                 $self->stdio_handle($remote);
                 $self->lookup_localhost() unless ($self->host);
                 $self->accept_hook if $self->can("accept_hook");
@@ -605,7 +607,7 @@
 
 =cut
 
-our $bad_request_doc = join "", <DATA>;
+$bad_request_doc = join "", <DATA>;
 
 sub bad_request {
     my $self = shift;

Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm	(original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm	Wed Oct 18 23:37:27 2006
@@ -7,7 +7,8 @@
 
 use CGI ();
 
-our $VERSION = $HTTP::Server::Simple::VERSION;
+use vars qw($VERSION $default_doc);
+$VERSION = $HTTP::Server::Simple::VERSION;
 
 =head1 NAME
 
@@ -69,7 +70,6 @@
 
 =cut
 
-our $default_doc;
 $default_doc = ( join "", <DATA> );
 
 sub handle_request {

Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm	(original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm	Wed Oct 18 23:37:27 2006
@@ -5,7 +5,8 @@
 use warnings;
 use HTTP::Server::Simple;
 
-our $VERSION = $HTTP::Server::Simple::VERSION;
+use vars qw($VERSION %ENV_MAPPING);
+$VERSION = $HTTP::Server::Simple::VERSION;
 
 my %clean_env = %ENV;
 
@@ -56,7 +57,7 @@
 
 =cut
 
-our %ENV_MAPPING = (
+%ENV_MAPPING = (
     protocol     => "SERVER_PROTOCOL",
     localport    => "SERVER_PORT",
     localname    => "SERVER_NAME",

Modified: HTTP-Server-Simple/t/01live.t
==============================================================================
--- HTTP-Server-Simple/t/01live.t	(original)
+++ HTTP-Server-Simple/t/01live.t	Wed Oct 18 23:37:27 2006
@@ -19,12 +19,12 @@
 
     my $pid=$s->background();
 
-    like($pid, qr/^-?\d+$/,'pid is numeric');
+    like($pid, '/^-?\d+$/', 'pid is numeric');
     select(undef,undef,undef,0.2); # wait a sec
 
     my $content=fetch("GET / HTTP/1.1", "");
 
-    like($content, qr/Congratulations/, "Returns a page");
+    like($content, '/Congratulations/', "Returns a page");
     is(kill(9,$pid),1,'Signaled 1 process successfully');
     wait or die "couldn't wait for sub-process completion";
 }
@@ -35,22 +35,22 @@
     my $pid=$s->background();
     diag("started server on $pid");
     select(undef,undef,undef,0.2); # wait a sec
-    like($pid, qr/^-?\d+$/,'pid is numeric');
+    like($pid, '/^-?\d+$/', 'pid is numeric');
 
     my $content=fetch("GET / HTTP/1.1", "");
-    like($content,qr/Congratulations/,"Returns a page");
+    like($content, '/Congratulations/', "Returns a page");
 
     eval {
 	like(fetch("GET your mum wet"),  # anything does!
-	     qr/bad request/i,
+	     '/bad request/i',
 	     "knows what a request isn't");
     };
     fail("got exception in client: $@") if $@;
 
-    like(fetch("GET / HTTP/1.1", ""), qr/Congratulations/,
+    like(fetch("GET / HTTP/1.1", ""), '/Congratulations/',
 	 "HTTP/1.1 request");
 
-    like(fetch("GET /"), qr/Congratulations/,
+    like(fetch("GET /"), '/Congratulations/',
 	 "HTTP/0.9 request");
 
     is(kill(9,$pid),1,'Signaled 1 process successfully');

Modified: HTTP-Server-Simple/t/03podcoverage.t
==============================================================================
--- HTTP-Server-Simple/t/03podcoverage.t	(original)
+++ HTTP-Server-Simple/t/03podcoverage.t	Wed Oct 18 23:37:27 2006
@@ -5,5 +5,5 @@
 
 eval "use Test::Pod::Coverage 1.04";
 plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
-all_pod_coverage_ok({  also_private => [ qr/^[A-Z_]+$/ ], });
+all_pod_coverage_ok({  also_private => [ '/^[A-Z_]+$/' ], });
 

Modified: HTTP-Server-Simple/t/04cgi.t
==============================================================================
--- HTTP-Server-Simple/t/04cgi.t	(original)
+++ HTTP-Server-Simple/t/04cgi.t	Wed Oct 18 23:37:27 2006
@@ -1,11 +1,18 @@
-use Test::More tests => 20;
+use Test::More;
 use Socket;
 use strict;
 
+eval "use Data::Dumper";
+if ($@) {
+    plan skip_all => "Data::Dumper not available";
+}else {
+    plan tests => 20;
+}
+
 use constant PORT => 13432;
 my $host = gethostbyaddr(inet_aton('localhost'), AF_INET);
 
-our %methods=(
+my %methods=(
               url => "url: http://$host:".PORT,
               path_info => 'path_info: /cgitest/path_info',
               server_name => "server_name: $host",
@@ -14,7 +21,7 @@
               request_method => 'request_method: GET',
             );
 
-our %envvars=(
+my %envvars=(
               SERVER_URL => "SERVER_URL: http://$host:".PORT.'/',
               SERVER_PORT => 'SERVER_PORT: '.PORT,
               REQUEST_METHOD => 'REQUEST_METHOD: GET',
@@ -34,15 +41,15 @@
 
   my $pid=$server->background;
 
-  like($pid,qr/^-?\d+$/,'pid is numeric');
+  like($pid, '/^-?\d+$/', 'pid is numeric');
 
   select(undef,undef,undef,0.2); # wait a sec
-  like(fetch("GET / HTTP/1.1",""),qr(NOFILE),'no file');
+  like(fetch("GET / HTTP/1.1",""), '/NOFILE/', 'no file');
 
   foreach my $method (keys(%methods)) {
     like(
           fetch("GET /cgitest/$method HTTP/1.1",""),
-          qr($methods{$method}),
+          "/$methods{$method}/",
           "method - $method"
         );
     select(undef,undef,undef,0.2); # wait a sec
@@ -51,7 +58,7 @@
   foreach my $envvar (keys(%envvars)) {
     like(
           fetch("GET /cgitest/$envvar HTTP/1.1",""),
-          qr($envvars{$envvar}),
+          "/$envvars{$envvar}/",
           "Environment - $envvar"
         );
     select(undef,undef,undef,0.2); # wait a sec
@@ -134,7 +141,7 @@
   package CGIServer;
   use base qw(HTTP::Server::Simple::CGI);
   use Env;
-  use Data::Dumper;
+  eval "use Data::Dumper";
 
 
   sub handle_request {
@@ -149,7 +156,7 @@
     print "Content-Type: text/html\r\nContent-Length: ";
     my $response;
     if($methods{$file}) {
-      $response="$file: ".$cgi->$file;
+      $response = "$file: ".$cgi->$file();
     } elsif($envvars{$file}) {
       $response="$file: $ENV{$file}";
     } else {


More information about the Rt-commit mailing list