You are the Weakest Link… Goodbye!
I am talking here about the cgi.rb class that comes with the standard Ruby distribution. It is awful.
Now, if you’re a newbie who wants to get very simple CGI scripts up and running, then there’s no problem, because every piece of documentation or article that I’ve seen talks about handling form data uploads and/or formatting HTML output. Very simple stuff and stuff that I did in Perl when I first did CGI programming. Over time, however, I found that it was far simpler to just use print statements or some kind of templating to do HTML output. That part of CGI.pm or cgi.rb is useless to me.
Form data uploads are useful, but I also need access to the environment data, such as user-agent, request-method and the like. Absolutely nothing talks about this. I’ve got the pickaxe book. I google’d. Repeatedly. Nothing.
I did finally find some info on a Ruby/FCGI page, but I don’t care anymore. I’m not interested in loading a bloated class which contains features I won’t use. CGI should only handle the CGI data interface. The output can easily be handled via some kind of HTML generator class, if that’s your bag.
So, that’s what I’m going to do. I’m going to write a C-extension that will take in all the pertinent CGI input, form data and environment, and put it into a Ruby hash. It shouldn’t take too long and will serve my needs quite well.