#!/usr/bin/ruby
require "cgi"
cgi = CGI.new("html5")
cookie = CGI::Cookie.new('name' => 'cookiemonster1',
'value' => 'California',
'expires' => Time.now + 3600)
cgi.out('cookie' => cookie) do
cgi.html + cgi.body { "The cookie has been set." }
end
The cookie has been set.