This code isn't working. whats missing?

#!/usr/bin/ruby -w
require "cgi"
$appcgi = CGI.new
puts $appcgi.header
$username = $appcgi.cookies['user']
puts "\r\n$username"