From: ara.t.howard@... Date: 2006-07-25T23:33:05+09:00 Subject: Re: FCGI: How do you use it? On Tue, 25 Jul 2006, Tom Allison wrote: > I'm kind of perplexed here so I'll ask the stupid questions. > > When I use perl and call for a CGI module, I get with it all kinds of really > cool abilities related to %ENV and STDIN/STDOUT and the ability to even set > cookies... > > I can't find much of anything about what FCGI/FastCGI offers in terms of > methods or properties that are similar.. > > Is it correct to assume that FCGI doesn't do any of this and if I'm > interested in any kind of CGI related functionality (headers, cookies, > %ENV...) then I should probably just load the CGI modules? fcgi loads the cgi module for you. when you write FCGI.each_cgi do |cgi| ^^^ ^^^ ^^^ end then cgi is a cgi object with all the methods any cgi object has (mostly). these are documented in standard ruby docs, which can be found most anywhere, including http://rubydoc.org. > Now onto the Ruby specific nature of the question, but if anyone here knows > the perl-specific question above I would also appreciate it: > > Is there some way I can run the ruby fcgi scripts from command line to test? > Editing and restarting apache all the time is not very fun. i answered this in your other post, but here it goes again: here is an example fcgi program: fortytwo :/var/www/html > cat env2.fcgi #! /usr/local/bin/ruby require 'rubygems' rescue nil require 'fcgi' require 'yaml' FCGI.each_cgi{|cgi| cgi.out{ "
#{ cgi.env_table.to_hash.to_yaml }
" }} and here's running it fortytwo :/var/www/html > ./env2.fcgi --- XAUTHORITY: /home/ahoward/.Xauthority GS_LIB: /home/ahoward/.fonts SSH_ASKPASS: /usr/libexec/openssh/gnome-ssh-askpass KONSOLE_DCOP_SESSION: DCOPRef(konsole-4421,session-4) MAIL: /var/spool/mail/ahoward KDEDIR: /usr > Under ruby should I load fcgi, cgi, cgi/cookie, cgi/session rather than > expecting any of this kind of insight into the HTTP process from the FCGI > working environment? (please don't take any of these negative questions to > be a slight on FCGI/FastCGI you don't need to load cgi. you must load cgi/cookie and cgi/session if you intende you use them. they are also documented in the standard docs. > It's a stupid question but I would feel stupider if I found I was loading > multiple modules when only one was required. I haven't really found > anything that tells me that fcgi does other than some rudimentary examples. > (or is it that simple and I'm just trying to make it complicated?) i think that may be the case ;-) the source is also quite simple if you take a look at it. fcgi ships with a pure ruby version which is light reading. > Simply put, I can't seem to find any way to discover what fcgi provides > under ruby (variables, methods). But I would like to use it and understand > that many do. > > The documentation around the whole FastCGI thing is either very slim or hard > to find. I did not find the whitepaper a very encouraging read since I'm > not designing an HTTP server. I'm trying to be a user of the product. the key is that fcgi hands you a cgi-like object and that object __is__ documented. good luck. -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama