wierd cgi behaviour in PP Ruby 1.8.0

D

Damphyr

Well it's the short calm period before the storm of an upcoming product
release and I 'm stealing time to code something interesting for a change.
And I've picked the time to switch from 1.6.8 to 1.8.0 :). Unfortunately
the calm period is much too short to be able to do it on the Linux boxes
(where code of some actual value is running ;) ) so I'm playing about
with the PP package.
And I've stumbled on some wierd behaviour using CGI.
The following code is straightforward and simple:

def taken? name
b=["one","two"]
return "" if (b.include?(name) )
return " not"
end

name="one"
puts "#{name} does #{taken?(name)} exist"
name="three"
puts "#{name} does #{taken?(name)} exist"

will give:
ruby simple.rb
one does exist
three does not exist.

Now, using a simple form and a mini http server (it's called Xerver -
it's a java thingy that comes in handy) that is cgi capable I duplicate
this functionality in the following:

require 'cgi'
def taken? name
b=["one","two"]
return "" if (b.include?(name) )
return " not"
end
cgi = CGI.new("html3") # add HTML generation methods
cgi.out {
cgi.html { cgi.head { cgi.title{"Availability"} }+
cgi.body { name=cgi.params["name"]
"#{name} does #{taken?(name)} exist"}
}
}

which outputs:

one does not exist

and

three does not exist


Does anybody have any idea why this would happen?
I'll test it on an Apache installation I've got, but I can't see why it
would be any different.
V.-

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top