Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
ruby-quiz # 26, wiki served by webrick
anne001
6/19/2006 11:56:00 AM
http://www.rubyquiz.com/q...
I tried to do everything as indicated on this post but I get an error:
I have wikiserver.rb in a folder /library/webserver/documents/ruby
--------->
#!/private/opt/local/bin/ruby -rcgi
require "webrick"
server = WEBrick::HTTPServer.new( :Port => 8080,
:DocumentRoot => "cgi-bin" )
['INT', 'TERM'].each do |signal|
trap(signal) { server.shutdown }
end
server.start
and wiki.cgi in a folder /library/webserver/documents/ruby/cgi-bin
------------->
#!/private/opt/local/bin/ruby -rcgi
H, B = %w'HomePage w7.cgi?n=%s'
c = CGI.new 'html4'
n, d = c['n'] != '' ? c['n'] : H, c['d']
t = `cat #{n}`
d != '' && `echo #{t = CGI.escapeHTML(d)} > #{n}`
c.instance_eval {
out {
h1 { n } +
a(B % H) { H } +
pre { t.gsub(/([A-Z]\w+){2}/) { a(B % $&) { $& } }
} +
form("get") {
textarea('d') { t } +
hidden('n', n) +
submit
}
}
}
I run ruby wikiserver.rb
then on the safari web browser
http://localhost:8080/wiki.cgi
---------->
ERROR CGIHandler: /Library/WebServer/Documents/ruby/cgi-bin/wiki.cgi:
/opt/local/lib/ruby/1.8/webrick/httpservlet/cgi_runner.rb:45:in `exec':
Exec format error - /Library/WebServer/Documents/ruby/cgi-bin/wiki.cgi
(Errno::ENOEXEC)
from
/opt/local/lib/ruby/1.8/webrick/httpservlet/cgi_runner.rb:45
ERROR CGIHandler: /Library/WebServer/Documents/ruby/cgi-bin/wiki.cgi
exit with 1
ERROR Premature end of script headers:
/Library/WebServer/Documents/ruby/cgi-bin/wiki.cgi
"GET /wiki.cgi HTTP/1.1" 500 363
- -> /wiki.cgi
How do I get this code to work? (using ruby 1.8.4)
1 Answer
anne001
6/20/2006 2:55:00 PM
0
I was able to run the ruby-quiz #26 wiki, I found the problem, somehow
copying and pasting in emacs, & became &
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
ruby-quiz # 26, wiki served by webrick
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password