Error
END
def urlescape(str)
CGI.escapeHTML(CGI.escape(str).gsub("+","%20"))
end
errormessagebody = <
I am using
MESSAGE
if defined?(ERRORLOG)
begin
a = File.open(ERRORLOG,"r").to_a
rescue Exception => e
errorstr = "Exception while opening #{ERRORLOG}:\n#{e}"
else
s = [a.pop]
s << a.pop while s.last.scan(/^\[([^\]]*)\] \[/).flatten[0] == a.last.scan(/^\[([^\]]*)\] \[/).flatten[0] || a.last =~ /^[^\[]/
errorstr = s.reverse.join
end
errormessagebody += <
Please report your browser, operating system, and what you did to
#{BUGREPORTMAIL}.
ERROR
if (errorstr)
$h << <
Please include the following as well:
#{CGI.escapeHTML(errorstr)}
ERROR
end
$h << " "
$h.out($cgi)
if AUTO_SEND_REPORT
tmpfile = "/tmp/error.#{rand(10000)}"
File.open(tmpfile,"w"){|f|
f << errorstr
}
`mail -s "Bug in dudle" #{BUGREPORTMAIL} < #{tmpfile}`
File.delete(tmpfile)
end