BW
Main Menu
Home
Contact Bill
lynda.com FAQ
Facebook
Linked In
Twitter
AMTP
Bio
Hire Bill
Bill’s Music
BW Whois
Boulder Pledge
UBE-Related
Blog
CGI Scripts
CMS Project
Music DB
Creative HTML
The CGI Book
Perl Book
BillyDos
Privacy
The End
· Sponsors ·
lynda.com video tutorials
amazon.com
Rheumatoid Arthritis
Site Design: Bill Weinman

CGI Scripts by Bill Weinman

test.cgi

This is a very simple script for testing a server's CGI interface. By using a minimal script you can concentrate on finding out what is required to run a Perl/CGI script on your server.

Here is the source code for test.cgi. Copy/paste this code into your text editor, and make sure that the line

#!/usr/bin/perl
is the first line in the file.


#!/usr/bin/perl
# test.cgi by Bill Weinman [http://bw.org/]
# Copyright 1995-2008 The BearHeart Group, LLC
# Free Software: Use and distribution under the same terms as perl.

use strict;
use warnings;
use CGI;

print foreach (
    "Content-Type: text/plain\n\n",
    "BW Test version 5.0\n",
    "Copyright 1995-2008 The BearHeart Group, LLC\n\n",
    "Versions:\n=================\n",
    "perl: $]\n",
    "CGI: $CGI::VERSION\n"
);

my $q = CGI::Vars();
print "\nCGI Values:\n=================\n";
foreach my $k ( sort keys %$q ) {
    print "$k [$q->{$k}]\n";
}

print "\nEnvironment Variables:\n=================\n";
foreach my $k ( sort keys %ENV ) {
    print "$k [$ENV{$k}]\n";
}

"Beam me aboard, Scotty." "Will a 2x4 do, Sir?"
At BHG Worldwide Headquarters it is now twenty-six till eleven, on Thursday, 18 April 2024.
·/.