From: "Booth, Peter" Date: 2002-10-21T07:32:38+09:00 Subject: Was User errorRE: Beginner Qn - Syntax error with STDIN.gets This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C27888.7F39839A Content-Type: text/plain Sorry for this - the problem was the line currentUser++ -----Original Message----- From: Booth, Peter Sent: Sunday, October 20, 2002 6:15 PM To: ruby-talk@ruby-lang.org Subject: Beginner Qn - Syntax error with STDIN.gets Can anyone tell me why I get a syntax error on the line containing buf = STDIN.gets below? Is there a ruby interpreter option that gives more detail on syntax errors? Peter Booth require 'net/http' intHostname = "myhost" intPort=18000 intPath="/home/" uids = IO.readlines("uids") currentUser = 0; while true puts "How many users to add?" buf="" buf = STDIN.gets newUsers = buf.to_i for i in 0...newUsers uid = uids[currentUser] headers = Hash.new headers["Proxy-Remote-User"] = uid h = Net::HTTP.new(intHostname,18000) puts "Fetching page for user #{uid} count #{currentUser}" resp, data = h.get(intPath, headers) puts "Got page for user #uid}: #{resp.message}" currentUser++ end end ------_=_NextPart_001_01C27888.7F39839A Content-Type: text/html

Sorry for this - the problem was the line currentUser++

 

-----Original Message-----
From: Booth, Peter
Sent: Sunday, October 20, 2002 6:15 PM
To: ruby-talk@ruby-lang.org
Subject: Beginner Qn - Syntax error with STDIN.gets

 

Can anyone tell me why I get a syntax error on the line

containing buf = STDIN.gets below?

 

Is there a ruby interpreter option that gives more detail on

syntax errors?

 

Peter Booth

 

 

require 'net/http'

 

intHostname = "myhost"

intPort=18000

intPath="/home/"

 

uids = IO.readlines("uids")

currentUser = 0;

 

while true

 

            puts "How many users to add?"

            buf=""

            buf = STDIN.gets

           

            newUsers = buf.to_i

           

            for i in 0...newUsers

                        uid = uids[currentUser]

 

                        headers = Hash.new

                        headers["Proxy-Remote-User"] = uid

 

                        h = Net::HTTP.new(intHostname,18000)

                        puts "Fetching page for user #{uid} count #{currentUser}"

                        resp, data = h.get(intPath, headers)

                        puts "Got page for user #uid}: #{resp.message}"

                        currentUser++

            end

           

end

------_=_NextPart_001_01C27888.7F39839A--