Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Net::HTTPServer wrapped CGI::Application

by gryphon (Abbot)
on May 18, 2005 at 17:27 UTC ( #458328=perlquestion: print w/replies, xml ) Need Help??

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.

code('Perl') || die;

  • Comment on Net::HTTPServer wrapped CGI::Application

Replies are listed 'Best First'.
Re: Net::HTTPServer wrapped CGI::Application
by merlyn (Sage) on May 18, 2005 at 17:34 UTC

      Once you add a default webmail application, your journey to the dark side will be complete.

      It would be really cool to let a user-agent do stately things, like tell the app "Let's do this part as SOAP" or "Hey, gimme XML with a side of gzip". That should be really easy stuff.

      Can we name it Naviho? :)

      brian d foy <>

        Just curious... why naviho? (spelling is Navajo btw.)

        Jason L. Froebe

        Team Sybase member

        No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: Net::HTTPServer wrapped CGI::Application
by samtregar (Abbot) on May 18, 2005 at 18:36 UTC
    There are lots of tiny HTTP servers that support CGI scripts. I suggest you pick one off freshmeat and run with it. No code required!


      Yeah, good point. That would solve my problem nicely (and very quickly). I guess the geek in me still wants to find a Perl wrapper, though. Thanks for the suggestion. I'm going to go searching FM now...

      code('Perl') || die;

Re: Net::HTTPServer wrapped CGI::Application
by sri (Vicar) on May 18, 2005 at 23:28 UTC
    Catalyst has a built in testserver (HTTP::Daemon based) for development and plug'n play support for CGI, Apache::Registry, mod_perl1, mod_perl1.99, mod_perl2, FastCGI, SpeedyCGI and some exotic platforms like Zeus... ;)
Re: Net::HTTPServer wrapped CGI::Application
by elwarren (Priest) on May 19, 2005 at 00:04 UTC
    Have you looked at HTTP::Daemon? There is a node here on PM about handling POST requests with it, but I cannot find it. I *did* however, find CGI::MiniSvr when I was googling for code snips.

    I've wanted to do this with a WikiWiki on a USB drive. Keeping it all perl allows me to easily move between different OS at work and home. I'm going to look into CGI::MiniSvr a bit, please update this thread if you make any progress, I'd like to hear about it.
Re: Net::HTTPServer wrapped CGI::Application
by gryphon (Abbot) on Jun 06, 2005 at 04:39 UTC

    Greetings fellow monks,

    I may have found a solution to this; at least it works for me. Here's a post about it.

    code('Perl') || die;

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://458328]
Approved by dragonchild
Front-paged by brian_d_foy
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2023-09-25 12:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found