Discussion Locked

Build a simple Web server

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Build a simple Web server with the HTTP::Daemon module:

The May 6, Perl TechMail discusses how to build a simple Web server using the HTTP::Daemon module. Will you use this technique for creating a Web server? Tell us how you plan to use it--or tell us why not.

If you haven't subscribed to the Perl TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:

http://builder.com.com/techmails.jhtml?repID=u001

4 replies

by manny

i pasted the code to a .pl file and executed it from dos and it said 'server open at...' but when i type the address shown (with or without the port number), i get 'cannot find server' error!

by james brown

When I run the code straight from the email I get the following:
Server open at http://localhost:1234/
127.0.0.1:3694 Connected
127.0.0.1:3694 Requested GET /
127.0.0.1:3694 Closed

I put the full server address (http://locahost:1234/) in my browser's (IE 5) URL line. It seemed to work fine. I got back the simple result page.

A couple of thoughts:
First, did you account for the long lines in the email that may have been wrapped? Depending on your mail client, it may have wrapped one or more lines.

Second, are you sure you have the latest versions of the three modules? Be sure you have current versions of HTTP::Daemon, HTTP::Status and HTTP::Response.

What platform are you running on? I'm using a Win 2K box with ActiveState Perl v5.6.1.

by manny

this is the perl install file i downloaded from activeperl:
ActivePerl-5.6.1.633-MSWin32-x86.msi
(i assume all the accompanying modules are current)

my box is also win 2k
i had un-wrapped the wrapped lines.
it prints the "Server open at.." message only so it must be hanging at the $daemon->accept method

This discussion is closed to new replies.