|
What this is
Other links
The source code
require "cgi/application"
require "hello/view/template"
module Hello
class Application < CGI::Application::SessionManaged
include Hello::View::Template
def timeout
60
end
def setup(opt={})
super
end
def do_start(cgi)
out('charset'=>'euc-jp') {
start
}
end
ARG_hello = Struct.new(:name, :count, :expire)
def do_hello(cgi, memo, chain)
arg = ARG_hello.new
session = new_session(cgi)
name = get_param(cgi, "name", :text)
session['name'] = name
arg.name = session['name']
session['count'] = '1'
arg.count = session['count']
arg.expire = Time.at(session['expire'].to_i).strftime("%H:%M:%S")
out('charset'=>'euc-jp') {
hello(arg)
}
end
def session_hello(cgi, session, memo, chain)
arg = ARG_hello.new
name = get_param(cgi, "name", :text)
session['name'] = name unless name.empty?
arg.name = session['name']
session['count'] = (session['count'].to_i + 1).to_s
arg.count = session['count']
arg.expire = Time.at(session['expire'].to_i).strftime("%H:%M:%S")
out('charset'=>'euc-jp') {
hello(arg)
}
end
def expired_hello(cgi, session, memo, chain)
arg = ARG_hello.new
name = get_param(cgi, "name", :text)
session['name'] = name unless name.empty?
arg.name = session['name']
session.delete
out('charset'=>'euc-jp') {
hello_expired(arg)
}
end
end
end
|
Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com