$| = 1;
######################### End of black magic.
# Set up a CGI environment
is $q->
query_string =>
'game=chess;game=checkers;weather=dull',
"CGI::query_string()";
is $q->
param('game'),
'chess',
"CGI::param()";
is $q->
param('weather'),
'dull',
"CGI::param()";
is join(' ',$q->param('game')),
'chess checkers',
"CGI::param()";
is $q->
query_string,
'game=chess;game=checkers;weather=dull;foo=bar',
"CGI::query_string() redux";
is $q->
http('love'),
'true',
"CGI::http()";
"CGI::url()";
'CGI::url(-relative=>1,-path=>1,-query=>1)';
ok !$q->
param('foo'),
'CGI::delete()';
is join(' ',$q->param('keywords')),
'mary had a little lamb',
'CGI::keywords';
ok $q=
new CGI('foo=bar&foo=baz'),
"CGI::new() redux";
is $q->
param('foo'),
'bar',
'CGI::param() redux';
ok $q=
new CGI({'foo'=>'bar','bar'=>'froz'}),
"CGI::new() redux 2";
is $q->
param('bar'),
'froz',
"CGI::param() redux 2";
# test tied interface
is $p->{
bar},
'froz',
"tied interface fetch";
is join(' ',$q->param('bar')),
'foo bar baz',
'tied interface store';
# test posting
{
is $q->param('weather'), 'nice',"CGI::param() from POST"; is $q->url_param('big_balls'), 'basketball',"CGI::url_param()"; }
# test url_param
{
# params present, param and url_param should return true
ok $q->param, 'param() is true if parameters';
ok !$q->param, 'param() is false if no parameters'; ok !$q->url_param, 'url_param() is false if no parameters';
is_deeply [$q->$_] => [ 'keywords' ], "$_ with QS='$ENV{QUERY_STRING}'"
}