#!/usr/local/bin/perl -Tw # If you use this on Windoze, remove the Tw switch. My PERL on win95 # complained that the T switch was too late here. You are seeing this from # a SGI IRIX 6.2 # I have the Gurusamy perl port 5004_02 on my Win95 machine with OMNIHttpd # This script was created by Brian E. Lavender (brian@brie.com). It uses the CGI module # packaged with perl 5.004 and above by Lincoln Stein use lib "/usr/dom/xbrie/brian/perl/lib"; # If you want to grab a module from somewhere else use this. Perl 5.004 comes with CGI but you may want to use a later version use strict; # This is for some sort of security. Variables have to be lexically scoped. "my" use CGI qw(:standard); # Import html methods so we can easily make headers and so forth (ie print h1('Banga Gong');) use CGI::Carp; # This will make our errors more noticeable in the error log. #### Variables, variables, variables below my $query = new CGI; # Create a new cgi object my $myself = $query->self_url; # This is so we can have links within the form without losing state my $N = "\n"; # So we don't have to type all those newlines in quotes my $formsub; # Lexically scope this variable. $formsub = "/cgi-bin/testing/urlpath.pl/1234rtgf"; # urlpath.pl is the cgi program. /1234ftgf is additional # path info ## get the Environment Data my $uri = $ENV{DOCUMENT_URI}; # valid only in SSI my $path = $ENV{PATH_INFO}; # stuff after cgi name my $agent = $ENV{HTTP_USER_AGENT}; # user agent my $wwwsvr = $ENV{SERVER_SOFTWARE}; # What web server are we using my $ip_addr = $ENV{REMOTE_ADDR}; # Users remote IP address print $query->header(-expires=>'+15s'); # Make this expire in one minute from loaded time print $query->start_html(-"title"=>'Temp stuff on the url', -"author"=>'brian@brie.com', -"meta"=>{'keywords'=>'cheese cheesy sonoma jack camembert', 'copyright'=>'Copyright 1997 Big Brie'}, -"BGCOLOR"=>'white'); print $N; print h2 ('URL path information and forms'); # Prints the version print "This uses the CGI module, version ", $CGI::VERSION, " \n"; # I think you will need at least CGI.pm 2.28 or something for this to work #my ($path) =~ s!^/(\w+)/?!; # Hmm, I forget why I left this here #print $path , "
",$N; print "\n"; # an anchor at the top of the page print "
", $N;
if ($uri) {print "The \$ENV{DOCUMENT_URI} is ", $uri, $N;} # This won't be defined because this is not an SSI
if ($path) {print "The \$ENV{PATH_INFO} is ", $path, $N;}
if ($agent) {print "The \$ENV{HTTP_USER_AGENT} is ", $agent, $N;}
if ($wwwsvr) {print "The \$ENV{SERVER_SOFTWARE} is ", $wwwsvr, $N;}
if ($ip_addr) {print "The \$ENV{REMOTE_ADDR} is ", $ip_addr, $N;}
print "\n";
print "
$N"; print $query->startform (-method=>'get', -action=> $formsub); print p, $N; #Print below #Uses the value of param('Name') unless the form is submitted with param('name') #This page is originally submitted with an html page print qq{See the data your typed
\n}; print qq{Oh yeah, there is a button if you don't want to
use the clickable images to submit the info \n}; print "

",$N; my $defname; if ($query->param('Name')){ $defname = $query->param('Name'); } print "Name: ", $query->textfield('name', $defname ,50),"\n"; print p, $N; print "Address: ",$query->textfield('address'),"\n"; print p, $N; print p, $N; my $commdefault = ''; if ( $query -> param('comments') ){ # Tests to see if comments have been submitted print 'The test for param(\'contents\') seems to work' , "
" , $N; $commdefault = $query->param('name') . " bytes floppy disk"; } unless ( $query -> param('comments') ){ #If there are comments skip this $commdefault = 'Replace this text with your comments'; } print "Comments: ", $query->textfield(-name=>'comments', -default=> $commdefault, -size=>70, -override=>1),"\n"; print $query->hidden(-name=>'hidden_brie', -default=>['france']); print p, $N; print $query->image_button('button_brie','/pictures/smllogo.gif','BOTTOM'); print p, $N; print $query->image_button('button_exclaim','/pictures/exclaim.gif','BOTTOM'); print p, "\n" , $N; print $query->submit(-name=>'dingle_button', -value=>'Push me harder!'); print $query->endform; print $query->p , $N; print "\n"; # an anchor at beginning of data print qq{Maybe you ought to go back up and retype that stuff
It looks as if the program goofed
\n}; print "Here is the stuff you typed in, " ; #This script can get hit initially with parameters from an html page #This script takes those params and makes a form, but #changes the param "Name" to "name" #Two different variables print $query->param('name'), $N if ($query->param('name')); print $query->param('Name'), $N if ($query->param('Name')); print $query->dump; # This will print out all the variables that were submitted # Personal stuff below print q{


(C) 1998

Brie Web Publishing
PO Box 19184
Sacramento, CA 95819
(916) 443-6195

}; print $query->end_html, "\n"; # Finish off the html