[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Creating a ruby "CGI" script

barjunk

4/10/2007 7:04:00 AM

I have been working with one of the Mentors from
rubymentor.rubyforge.org. Through our e-mail conversation and some
experimenting, I learned several things. I am posting them here
because I think it is helpful to all who might come after me and to
show my appreciation for the help that has been given.

There were several parts to making a 'CGI' script using ruby:

- Configuring the apache server(that's what I was using): Some
important points are to have the Options +ExecCGI options for your
particular site and for ScriptAlias to be pointing at the directory
that contains the intended ruby script. Looking at the apache log
files started me in the right direction for these things.

- Writing the script: There is a reasonable example in the online
book ( http://www.ruby-doc.org/docs/ProgrammingRuby/htm... ).
However, what it didn't mention is that you can test things by
executing the program on the command line and providing your
environment variables to the script followed by a control-D. I found
this after googling a little.

- Setting permissions: This is obvious for most people...but it
should be mentioned. The permissions on your script need to be set so
that your webserver will be able to read and execute them ( anyone
want to share best practices here?)

It would be great if others with way more experience could clear up
any mistatements I might have made because of my lack of experience.
Best practices examples are most welcome.

Thanks.

Mike B.

1 Answer

SonOfLilit

4/10/2007 7:16:00 AM

0

On 4/10/07, barjunk <barjunk@attglobal.net> wrote:
> I have been working with one of the Mentors from
> rubymentor.rubyforge.org. Through our e-mail conversation and some
> experimenting, I learned several things. I am posting them here
> because I think it is helpful to all who might come after me and to
> show my appreciation for the help that has been given.
>
> There were several parts to making a 'CGI' script using ruby:
>
> - Configuring the apache server(that's what I was using): Some
> important points are to have the Options +ExecCGI options for your
> particular site and for ScriptAlias to be pointing at the directory
> that contains the intended ruby script. Looking at the apache log
> files started me in the right direction for these things.
>
> - Writing the script: There is a reasonable example in the online
> book ( http://www.ruby-doc.org/docs/ProgrammingRuby/htm... ).
> However, what it didn't mention is that you can test things by
> executing the program on the command line and providing your
> environment variables to the script followed by a control-D. I found
> this after googling a little.
>
> - Setting permissions: This is obvious for most people...but it
> should be mentioned. The permissions on your script need to be set so
> that your webserver will be able to read and execute them ( anyone
> want to share best practices here?)
>
> It would be great if others with way more experience could clear up
> any mistatements I might have made because of my lack of experience.
> Best practices examples are most welcome.
>
> Thanks.
>
> Mike B.
>
>

Hello Mike,

glad you benefited from RubyMentor.

Would you two agree to post your conversation logs to the wiki?
Currently there's only mine and Samantha's, and I'd like there to be
more examples.

That and it being a great resource, too.


Aur