r15046 - in /trunk/libhttp-server-simple-perl: Changes SIGNATURE debian/changelog lib/HTTP/Server/Simple.pm

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sun Feb 17 01:30:57 UTC 2008


Author: gregoa-guest
Date: Sun Feb 17 01:30:57 2008
New Revision: 15046

URL: http://svn.debian.org/wsvn/?sc=1&rev=15046
Log:
New upstream release.

Modified:
    trunk/libhttp-server-simple-perl/Changes
    trunk/libhttp-server-simple-perl/SIGNATURE
    trunk/libhttp-server-simple-perl/debian/changelog
    trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm

Modified: trunk/libhttp-server-simple-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libhttp-server-simple-perl/Changes?rev=15046&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/Changes (original)
+++ trunk/libhttp-server-simple-perl/Changes Sun Feb 17 01:30:57 2008
@@ -1,3 +1,7 @@
+0.29 Fri Feb 15 11:43:29 EST 2008
+
+* new example section from almut on perlmonks
+
 0.28 Tue Jan 15 09:33:58 EST 2008
  * New restartability support from Mark Stosberg
 

Modified: trunk/libhttp-server-simple-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/trunk/libhttp-server-simple-perl/SIGNATURE?rev=15046&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/SIGNATURE (original)
+++ trunk/libhttp-server-simple-perl/SIGNATURE Sun Feb 17 01:30:57 2008
@@ -14,7 +14,7 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 675ffe663efe035cc65047502345938904d9d0e1 Changes
+SHA1 1169fda38432a0b835a619128f524a44dbf913cc Changes
 SHA1 0ac508c50476dcc2bf8fe3094cb341425291e1ee MANIFEST
 SHA1 de5abaa8229fa5378d21eeb328081c8f14a7b488 META.yml
 SHA1 3a02ba613b11b07dd1fa97e2a6b962ee3e039c98 Makefile.PL
@@ -28,7 +28,7 @@
 SHA1 5d6189b2cad15cf9932a28faafd55130c8247e83 inc/Module/Install/Metadata.pm
 SHA1 02af973fae2ac3531fa6b704574b2b8cb2a08148 inc/Module/Install/Win32.pm
 SHA1 3a2eab96e91cca8d99938cda7791759ae9d97b3a inc/Module/Install/WriteAll.pm
-SHA1 1ed5f4a8a4aa0a6bf5cc9a7be817a913dbed174e lib/HTTP/Server/Simple.pm
+SHA1 f3dc37bcbde91e7842c39a9aed62e68f188ea5cf lib/HTTP/Server/Simple.pm
 SHA1 40f24374f2b5845a3025e14ca4b91bd58298de03 lib/HTTP/Server/Simple/CGI.pm
 SHA1 47ef836a1cdd03add505dd4c90819cafb61dc565 lib/HTTP/Server/Simple/CGI/Environment.pm
 SHA1 db064af54cab345a71daec576e32e64b8fb1033d t/00smoke.t
@@ -37,9 +37,9 @@
 SHA1 a7024d0d8e7b80d26f75a3551a1406a797b382f8 t/03podcoverage.t
 SHA1 bc9dc786924d61aa0dc8747c1d68f47cf421ec37 t/04cgi.t
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
+Version: GnuPG v1.4.8 (Darwin)
 
-iD8DBQFHjMRyEi9d9xCOQEYRAg5UAKC6K4D3TqcEiAoGSMZW7WtAZtdz2wCgieho
-SnitUjgps/2KV99Xuv1Dchc=
-=sEH7
+iD8DBQFHtcFPEi9d9xCOQEYRAsxZAKDA8ITW0PRKPl/szr3nRGyy0dIIuwCbBUqW
+vZRZsBd3mlE7l0EkMlxXV1M=
+=nUTd
 -----END PGP SIGNATURE-----

Modified: trunk/libhttp-server-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libhttp-server-simple-perl/debian/changelog?rev=15046&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/changelog (original)
+++ trunk/libhttp-server-simple-perl/debian/changelog Sun Feb 17 01:30:57 2008
@@ -1,3 +1,9 @@
+libhttp-server-simple-perl (0.29-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Sun, 17 Feb 2008 02:30:12 +0100
+
 libhttp-server-simple-perl (0.28-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm
URL: http://svn.debian.org/wsvn/trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm?rev=15046&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm (original)
+++ trunk/libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm Sun Feb 17 01:30:57 2008
@@ -1,13 +1,14 @@
-package HTTP::Server::Simple;
 use strict;
 use warnings;
+
+package HTTP::Server::Simple;
 use FileHandle;
 use Socket;
 use Carp;
 use URI::Escape;
 
 use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.28';
+$VERSION = '0.29';
 
 
 =head1 NAME
@@ -72,6 +73,60 @@
 could kill the server
 
 =back
+
+=head1 EXAMPLE
+ 
+ #!/usr/bin/perl
+ {
+ package MyWebServer;
+ 
+ use HTTP::Server::Simple::CGI;
+ use base qw(HTTP::Server::Simple::CGI);
+ 
+ my %dispatch = (
+     '/hello' => \&resp_hello,
+     # ...
+ );
+ 
+ sub handle_request {
+     my $self = shift;
+     my $cgi  = shift;
+   
+     my $path = $cgi->path_info();
+     my $handler = $dispatch{$path};
+ 
+     if (ref($handler) eq "CODE") {
+         print "HTTP/1.0 200 OK\r\n";
+         $handler->($cgi);
+         
+     } else {
+         print "HTTP/1.0 404 Not found\r\n";
+         print $cgi->header,
+               $cgi->start_html('Not found'),
+               $cgi->h1('Not found'),
+               $cgi->end_html;
+     }
+ }
+ 
+ sub resp_hello {
+     my $cgi  = shift;   # CGI.pm object
+     return if !ref $cgi;
+     
+     my $who = $cgi->param('name');
+     
+     print $cgi->header,
+           $cgi->start_html("Hello"),
+           $cgi->h1("Hello $who!"),
+           $cgi->end_html;
+ }
+ 
+ } 
+ 
+ # start the server on port 8080
+ my $pid = MyWebServer->new(8080)->background();
+ print "Use 'kill $pid' to stop server.\n";
+
+=head1 METHODS 
 
 =head2 HTTP::Server::Simple->new($port)
 
@@ -645,13 +700,15 @@
 
 =head1 AUTHOR
 
-Copyright (c) 2004-2006 Jesse Vincent, <jesse at bestpractical.com>.
+Copyright (c) 2004-2008 Jesse Vincent, <jesse at bestpractical.com>.
 All rights reserved.
 
 Marcus Ramberg <drave at thefeed.no> contributed tests, cleanup, etc
 
 Sam Vilain, <samv at cpan.org> contributed the CGI.pm split-out and
 header/setup API.
+
+Example section by almut on perlmonks, suggested by Mark Fuller.
 
 =head1 BUGS
 




More information about the Pkg-perl-cvs-commits mailing list