wierd cgi behaviour in PP Ruby 1.8.0

Discussion in 'Ruby' started by Damphyr, Jan 29, 2004.

  1. Damphyr

    Damphyr Guest

    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.
     
    Damphyr, Jan 29, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shailan
    Replies:
    2
    Views:
    1,069
    Shailan
    Dec 15, 2003
  2. Simon

    Wierd DataGrid behaviour

    Simon, Nov 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    370
    Simon
    Nov 5, 2003
  3. PSN
    Replies:
    3
    Views:
    373
  4. Vaddina Prakash Rao

    Wierd behaviour of function 'strcspn'

    Vaddina Prakash Rao, Dec 17, 2004, in forum: C Programming
    Replies:
    2
    Views:
    345
    Dave Thompson
    Dec 20, 2004
  5. SiWi
    Replies:
    3
    Views:
    834
    geremy condra
    Dec 9, 2009
Loading...

Share This Page