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

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

Greetings fellow monks,

I've been working on a spike for an idea I had: Taking an existing and fairly complex CGI::Application web app and wrapping it inside a Net::HTTPServer script. The idea being that I want to have the core application continue to live on an Apache mod_perl server for general use, but I'd also like to be able to transport the whole thing on a thumbnail drive. The app would be used by "less than completely technical" folk, so I'd like to be able to say, "Plug this into there, then double-click this."

Using $ENV{CGI_APP_RETURN_ONLY} = 1, I'm capturing the web app's output, then I'm seperating the header from the body and having the wrapper script set the appropriate Net::HTTPServer stuff. This works well for GET requests, but it starts to fall appart for POSTs and reading /writing cookies. Ultimately, what I'd love to be able to do is just have my wrapper script pass the request directly to the web app, then return directly whatever the web app returns.

Has anyone done this before? Is Net::HTTPServer the appropriate method? I'm not married to the module, so I'm happy to try something else. With a little work, I can get my wrapper script to do everything I want it to, but it seems kinda silly and a waste of time given that there's bound to be something already done for this sort of thing.

Thanks in advance for your help.

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