diff --git a/helloi.rb b/helloi.rb new file mode 100755 index 0000000..90ab15b --- /dev/null +++ b/helloi.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +require 'cgi' + +c = CGI.new +name = c["onamae"] + +print "Content-type: text/html\n\n" # お約束 + +print(< + +Hello!!! + +
+

あなたの名前:

+

+

+
+

こんにちは#{name}さん!!

+ + +EOF diff --git a/web.rb b/web.rb new file mode 100755 index 0000000..1c75e9b --- /dev/null +++ b/web.rb @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# $B@_CVJ}K!(B: +# 1. $B?75,$K%G%#%l%/%H%j$r:n$k(B: $BNc(B: +# cd Ruby +# mkdir cgi +# cd cgi +# 2. $B:n@.$7$?%G%#%l%/%H%j(B($BNc$G$O(B ~/Ruby/cgi)$B$K(B web.rb hello.rb $B$rJ]B8$9$k(B +# 3. $B (ENV["PORT"]||3000), + :DocumentRoot => ENV["DOCROOT"]||".", + :DirectoryIndex => ["hello.rb"] +) +trap("INT") { s.shutdown } +s.start