Auto-Require some .rb files for specific .cgi page

M

Marc Heiler

I am using Linux + Apache + ruby 1.8.7 (2009-06-08 patchlevel 173)

I use quite many .cgi pages which are nothing more than .rb files
which output a html string.

I found that every of this .cgi page requires my "web.rb" file.

Is it somehow possible to auto-load this file _without_ doing
require 'web.rb'? It is tedious to require that web.rb for every
ruby .cgi page. I wonder if what I would like to have is
somehow possible at all.
 
P

Peter Zotov

Marc said:
I am using Linux + Apache + ruby 1.8.7 (2009-06-08 patchlevel 173)

I use quite many .cgi pages which are nothing more than .rb files
which output a html string.

I found that every of this .cgi page requires my "web.rb" file.

Is it somehow possible to auto-load this file _without_ doing
require 'web.rb'? It is tedious to require that web.rb for every
ruby .cgi page. I wonder if what I would like to have is
somehow possible at all.

You can add '-r somefile.rb' to ruby command string, so the whole
command will become 'ruby -r web.rb script.rb', for example. Try
modifying shebang line/apache options/etc. for this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top