http://qs321.pair.com?node_id=470355

jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

My monster Windows GUI application (all written in Perl and Tk!) just refuses to lie down. It is approaching 50,000 lines and the client seems to want it to get bigger.

Right now I have been requested to add support for an API which is not really an API in my book! It was written to support web servers and you start a process by sending it a POST with a complex set of custom headers and an XML file of data. The responses come back as HTTP GET requests to a server. What I need to do is have an HTTP server that will handle some basic CGI - ie it should take the XML which is sent by the remote 'client' - parse it, and store the resultant information in a database (we are using MySQL already on the project so this is no issue).

What suggestions do you have for a simple, Perl based preferably, HTTP server for Windows (2000 & XP) which I will probably start as one or more spearate processes and just let them run. They do not need to interact with the programme at all.

jdtoronto

  • Comment on Adding HTTP server to Windows App - suggestions please!

Replies are listed 'Best First'.
Re: Adding HTTP server to Windows App - suggestions please!
by Corion (Patriarch) on Jun 27, 2005 at 19:21 UTC
Re: Adding HTTP server to Windows App - suggestions please!
by dragonchild (Archbishop) on Jun 27, 2005 at 19:19 UTC
    HTTP::Daemon is good, if very barebones. Catalyst has a good webserver in their stuff. Lots and lots of options. Womble around CPAN for a while with the search "http server" and you'll find dozens of good options.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Adding HTTP server to Windows App - suggestions please!
by gryphon (Abbot) on Jun 27, 2005 at 23:29 UTC

    Greetings jdtoronto,

    In addition to the other fine modules and approaches other monks have pointed out, you may also want to look at Net::HTTPServer as a way to add HTTP functionality to your existing application. I posted about my experiences trying to wrap an existing CGI::Application web application here and here.

    Net::HTTPServer doesn't do much on its own by way of cookies, headers, redirects, and other such things, but it does have a fairly good interface that lets you add whatever functionality you need. From your original post, it looks like you wouldn't have to do much.

    For the XML processing, I would strongly recommend XML::Simple. It's powerful and easy to use. I doubt you'll need something more complex, but if you do, I've heard good things about XML::LibXML.

    gryphon
    Whitepages.com Development Manager (DSMS)
    code('Perl') || die;

Re: Adding HTTP server to Windows App - suggestions please!
by gellyfish (Monsignor) on Jun 27, 2005 at 19:07 UTC

    You already have IIS on Windows, no need to recreate that particular wheel, all you have to do is create a small CGI program that does the required processing.

    /J\

      But IIS is not going to be installed on user machines. I have thousands of copies of the product out there and I am limited to what I can install myself using our NSIS based installer or using another Perl programme.

      jdtoronto

Re: Adding HTTP server to Windows App - suggestions please!
by Tanktalus (Canon) on Jun 28, 2005 at 01:29 UTC

    Oddly enough, IO::All may provide the server side relatively painlessly, as well. Its docs seem to talk about a one-line web server that does CGI, which I thought was an oddity, and here you may find it quite useful (I'd suggest some more whitespace, and, perhaps, a slightly more advanced usage, but the one-liner may get you started). Then use one of the myriad of XML modules to parse the XML - depending on what you're dealing with, XML::Simple may suffice, although XML::Twig has always been my favourite.