use strict; use warnings; use Test::More tests => 2; $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'game=chess&game=ludo&weather=dull'; $ENV{PATH_INFO} = '/somewhere/else'; $ENV{PATH_TRANSLATED} = '/usr/local/somewhere/else'; $ENV{SCRIPT_NAME} = '/cgi-bin/foo.cgi'; $ENV{SERVER_PROTOCOL} = 'HTTP/1.0'; $ENV{SERVER_PORT} = 80; $ENV{SERVER_NAME} = 'here.there.com'; my $out = `/path/to/my/script.cgi`; like ($out, qr/Content-type: text\/html/, 'HTML response'); like ($out, qr/foo/, 'Foo found');