[cgiapp] CGI::Applicaiton and POE

Michael De Soto pronet at quarghost.com
Mon May 4 11:56:59 EDT 2009


I need some advice from the CGI::App gurus.

I'm working on an application used by my tech support department for
quick diagnosis of DNS problems. It's basically a web front end to a
DNS resolver with some spit shine on the results. The fact the techs
aren't trained (or maybe can't be trained) to read the response from a
simple dig or nslookup is a testament to the quality of the
department. But that's neither here nor there.

Enter CGI::App. For about a year I've been using CGI::App and Net::DNS
to do the job. It's worked well. However, now our tech support
department is asking for some more powerful tools which necessitate
concurrent DNS queries. I've written a proof of concept using the
native Net::DNS bgsend/bgread methods, but it's just not doing the
job. These methods also remove our ability to do true recursive
queries.

Enter POE. I found POE, more specifically POE::Component::Client::DNS
which folds Net::DNS into POE's multitasking environment. I've never
used POE before, but after reading some of the documentation I see
that it's powerful and exactly what I need. Using the cookbook
example[1],  I've been able to run 200 simple queries and receive
160-170responses in about 3 seconds. Just awesome.

Here's where I need advice: The cookbook example shows POE used as a
stand alone script. The other documentation I've read on POE and CGI
shows the CGI framework used inside POE to make a simple HTTP server.
This seems to be the opposite of my requirements. I don't want to
implement an HTTP server, nor do I want to spawn off multiple
CGI::Application processes. I simply need to take and untaint
information from a CGI::App run mode, send it off to my POE DNS
module, and then return it to CGI::App for final processing and
display.

Frankly, I'm not sure how I should approach it. Ideally I'd have a
package which has a method to receive my input and then spawn off the
process to do the query. I'll have to look at the docs again, but my
first impression is that it's not that easy.

  * Do the gurus have experience with POE and CGI::App and/or advice
on how to approach?
  * Are you aware of any documentation that uses POE within a web
application as I describe above.

I've been Googling for a day or so, but as I'm sure you know,
searching for CGI and CGI::Application returns many bunk results.






[1] http://poe.perl.org/?POE_Cookbook/DNS_Lookups


More information about the cgiapp mailing list