Skip Menu |
 

This queue is for tickets about the HTTP-Server-Simple CPAN distribution.

Report information
The Basics
Id: 21727
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: SAPER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.20
Fixed in: (no value)

Attachments
HTTP-Server-Simple-0.20-perl5.004-02.diff
HTTP-Server-Simple-0.20-perl5.004.diff



Subject: [PATCH] Support for Perl 5.004
Download (untitled) / with headers
text/plain 591b
I can already hear you shout in a mix of horror and anger "Why are you still using a version of Perl that should be only talked about in archeology class?" And I agree, Perl should be upgraded, but there are cases where you just can't do that. And I wanted to use HTTP::Server::Simple. So I patched it and as I expected it was quite short and easy. Hence this ticket, mostly for the records in case someone else wants to use the module on an older Perl. With this patch, HTTP::Server::Simple 0.20 passes all tests on Perl 5.004_05. Regards, -- Close the world, txEn eht nepO.
Subject: HTTP-Server-Simple-0.20-perl5.004.diff
diff -ru HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple/CGI/Environment.pm HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple/CGI/Environment.pm --- HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple/CGI/Environment.pm 2006-06-07 21:26:29.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple/CGI/Environment.pm 2006-09-26 15:18:17.853103679 +0200 @@ -2,10 +2,11 @@ package HTTP::Server::Simple::CGI::Environment; use strict; -use warnings; +#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", @@ -69,7 +70,7 @@ ); sub setup_environment_from_metadata { - no warnings 'uninitialized'; + #no warnings 'uninitialized'; my $self = shift; # XXX TODO: rather than clone functionality from the base class, diff -ru HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple/CGI.pm HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple/CGI.pm --- HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple/CGI.pm 2006-06-07 21:26:29.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple/CGI.pm 2006-09-26 14:38:00.091744446 +0200 @@ -3,11 +3,12 @@ use base qw(HTTP::Server::Simple HTTP::Server::Simple::CGI::Environment); use strict; -use warnings; +#use warnings; 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 { diff -ru HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple.pm HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple.pm --- HTTP-Server-Simple-0.20-orig/lib/HTTP/Server/Simple.pm 2006-06-15 16:05:14.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/lib/HTTP/Server/Simple.pm 2006-09-26 15:09:51.738877196 +0200 @@ -1,15 +1,16 @@ package HTTP::Server::Simple; -use 5.006; use strict; -use warnings; +use FileHandle; use Socket; use Carp; -our $VERSION = '0.20'; +use vars qw($VERSION $bad_request_doc); +$VERSION = '0.20'; + =head1 NAME -HTTP::Server::Simple +HTTP::Server::Simple - Lightweight HTTP server =head1 SYNOPSIS @@ -253,7 +254,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"); @@ -604,7 +605,7 @@ =cut -our $bad_request_doc = join "", <DATA>; +$bad_request_doc = join "", <DATA>; sub bad_request { my $self = shift; diff -ru HTTP-Server-Simple-0.20-orig/t/01live.t HTTP-Server-Simple-0.20-perl5.004/t/01live.t --- HTTP-Server-Simple-0.20-orig/t/01live.t 2006-06-07 21:26:29.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/t/01live.t 2006-09-26 14:49:57.293865190 +0200 @@ -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'); diff -ru HTTP-Server-Simple-0.20-orig/t/03podcoverage.t HTTP-Server-Simple-0.20-perl5.004/t/03podcoverage.t --- HTTP-Server-Simple-0.20-orig/t/03podcoverage.t 2006-06-07 21:26:29.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/t/03podcoverage.t 2006-09-26 14:38:44.570557947 +0200 @@ -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_]+$/' ], }); diff -ru HTTP-Server-Simple-0.20-orig/t/04cgi.t HTTP-Server-Simple-0.20-perl5.004/t/04cgi.t --- HTTP-Server-Simple-0.20-orig/t/04cgi.t 2006-06-07 21:26:29.000000000 +0200 +++ HTTP-Server-Simple-0.20-perl5.004/t/04cgi.t 2006-09-26 15:24:24.409878637 +0200 @@ -5,7 +5,7 @@ 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 +14,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 +34,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 +51,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 @@ -149,7 +149,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 {
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #21727] [PATCH] Support for Perl 5.004
Date: Thu, 28 Sep 2006 13:05:05 -0400
To: S [...] bestpractical.com
From: jesse <jesse [...] fsck.com>
Download (untitled) / with headers
text/plain 754b
Show quoted text
> I can already hear you shout in a mix of horror and anger "Why are > you still using a version of Perl that should be only talked about > in archeology class?"
Nope. I totally understand the requirement. I just wish there were a way to apply this without killing warnings ;) Show quoted text
> > And I agree, Perl should be upgraded, but there are cases where you > just can't do that. And I wanted to use HTTP::Server::Simple. So I > patched it and as I expected it was quite short and easy. Hence this > ticket, mostly for the records in case someone else wants to use the > module on an older Perl. > > With this patch, HTTP::Server::Simple 0.20 passes all tests on > Perl 5.004_05. > > > Regards, > > -- > Close the world, txEn eht nepO.
--
Subject: Re: [rt.cpan.org #21727] [PATCH] Support for Perl 5.004
Date: Wed, 04 Oct 2006 13:14:17 +0200
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Download (untitled) / with headers
text/plain 558b
Jesse wrote: Show quoted text
> > I can already hear you shout in a mix of horror and anger "Why are > > you still using a version of Perl that should be only talked about > > in archeology class?"
> > Nope. I totally understand the requirement. I just wish there were a way > to apply this without killing warnings ;)
I was pondering a warnings.pm emulation for older Perl, and recently JFDI: » http://search.cpan.org/dist/warnings-compat/ Now I can rewrite the patch so it doesn't remove the warnings. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #21727] [PATCH] Support for Perl 5.004
Date: Thu, 19 Oct 2006 00:31:32 +0200
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <maddingue [...] free.fr>
Download (untitled) / with headers
text/plain 100b
Hello, Here is a new patch which keeps the warnings and also eval-use Data::Dumper in the tests.

Message body is not shown because sender requested not to inline it.

-- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #21727] [PATCH] Support for Perl 5.004
Date: Wed, 18 Oct 2006 23:40:04 -0400
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: jesse <jesse [...] fsck.com>
Download (untitled) / with headers
text/plain 500b
Thanks! Applied. 0.22 is on its way to cpan right now. On Wed, Oct 18, 2006 at 06:31:54PM -0400, S?bastien Aperghis-Tramoni via RT wrote: Show quoted text
> > Queue: HTTP-Server-Simple > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21727 > > > Hello, > > Here is a new patch which keeps the warnings and also eval-use > Data::Dumper in the tests.
That needed a tiny bit of a patch, but it's taken care of. Show quoted text
> > > -- > S?bastien Aperghis-Tramoni > > Close the world, txEn eht nepO.
--


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.