#!/Ruby/bin/ruby.exe
print "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n"
class Greeter
def initialize name='default'
@name= name.capitalize
end
def salut
print "Hello #{@name}! \r\n\r\n"
end
end
print "Hello. \r\n\r\n"
g= Greeter.new "world"
g.salut
g= Greeter.new
g.salut
But for some reason ruby outputs "\r\n\r\n" when I tell it to output "\r\n"; anyone know how to fix that? Maybe something like binmode (as in Perl)?
Here's what it's supposed to output (hexadecimal):
0x485454502F312E3020323030204F4B0D0A436F6E74656E742D547970653A20746578742F706C61696E0D0A0D0A48656C6C6F2E200D0A0D0A48656C6C6F20576F726C6421200D0A0D0A48656C6C6F2044656661756C7421200D0A0D0AAnd here's what it outputs (hexadecimal):
0x485454502F312E3020323030204F4B0D0A0D0A436F6E74656E742D547970653A20746578742F706C61696E0D0A0D0A0D0A0D0A48656C6C6F2E200D0A0D0A0D0A0D0A48656C6C6F20576F726C6421200D0A0D0A0D0A0D0A48656C6C6F2044656661756C7421200D0A0D0A0D0A0D0A
(I converted the stuff to hexadecimal before pasting it here.)


Sign In
Create Account


Back to top









