From: "Booth, Peter" Date: 2002-10-21T07:14:34+09:00 Subject: 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_01C27886.0D4AC570 Content-Type: text/plain 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_01C27886.0D4AC570 Content-Type: text/html

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_01C27886.0D4AC570--