cgi vs. fcgi question

T

Tom Allison

Under CGI I can create a cgi object like:

cgi = CGI.new("html4")
and have methods available to me like .head, .body, and so on.

Under FCGI the cgi is created for me.
I don't see any way to make any CGI methods available to me so that I
can write an FCGI script like:

FCGI.each_cgi do |cgi|
cgi.out{
cgi.html {
cgi.head{ "\n" + cgi.title("This is a Test"} } +
cgi.body{ "\n" + "<p>This is indeed a test..</p>"}
}
}
end

it complains that .html is unkown.
I can't seem to find any class methods to set this up.

Am I really relegated to writing everything under FCGI as just cgi.out{ } ?
 
T

Timothy Hunter

Tom said:
never heard of them. How do I install these?
You are in for a treat. http::rubyforge.org is the home of both
libraries, along with 100's of other Ruby projects. Check it out!
 
T

Tom Allison

Timothy said:
You are in for a treat. http::rubyforge.org is the home of both
libraries, along with 100's of other Ruby projects. Check it out!

Looks like CPAN.org to me.

Um... Not to sound utterly retarded, but how does it work?

If I am supposed to install the modules using gems, I don't have gems
installed either. So do I need to start there or what?

I'm literally at step 0.
I'm also curious if this has a better uninstall process than CPAN (which
has no uninstall process)
 
J

James Britt

Tom said:
I'm literally at step 0.

Go to RubyForge and locate the rubygems library. There's a search field
on the main page.

Download rubygems, latest version. Extract and install as per the
README or INSTALL file that I'm pretty sure is included.

You may want to be root so that the library and scripts are placed
correctly.


You can now run, for example:

gem install markaby
I'm also curious if this has a better uninstall process than CPAN (which
has no uninstall process)

gem uninstall markaby

If the gem is needed by other gems you should get warnings and an option
to stop the uninstalling.

There are assorted options you can pass when installing, upgrading, and
such, so try running

gem help

to learn more. And ask questions here, too, if you try but cannot
figure something out.
 
T

Tom Allison

gem help

to learn more. And ask questions here, too, if you try but cannot
figure something out.

I started playing with this and ran into a lack of PATH (I guess).
require doesn't find the library I just installed.
ri doesn't either, but someone mentioned gemri instead.

I guess this puts me at step 0.0.1?
 
J

James Britt

Tom said:
I started playing with this and ran into a lack of PATH (I guess).
require doesn't find the library I just installed.
ri doesn't either, but someone mentioned gemri instead.

Does your code include

require 'rubygems'

before you try to load files installed as gems?

You can also define that on the command line:

ruby -rubygems my_app.rb

or add it to your RUBYOPT environment variable

e.g.

RUBYOPT=rubygems

But one why or another you need to tell Ruby that it should load the
rubygems library first, and that then takes care of looking for gem files.
I guess this puts me at step 0.0.1?

Oh, I say at least 0.1.



--
James Britt

"I was born not knowing and have had only a little
time to change that here and there."
- Richard P. Feynman
 
T

Timothy Hunter

Tom said:
I started playing with this and ran into a lack of PATH (I guess).
require doesn't find the library I just installed.
ri doesn't either, but someone mentioned gemri instead.

I guess this puts me at step 0.0.1?
You don't have to stumble around in the dark while waiting for some kind
soul here to guide you. RubyGems has good user doc, available from the
RubyGems project page at the link marked "Project Home Page". Here's the
link: http://docs.rubygems.org/. (This link is also the #1 result if you
Google for "rubygems".)

Here's something that a lot of newcomers miss: RubyGems is not only a
way to install Ruby libraries, it's also the mechanism for using these
libraries after they're installed. Look at "Chapter 3.4 Post-install --
Setting Up the RubyGems Environment" for the details.
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top