cgi-dev

Repository that serves as my CGI "scratchpad" to try things out.
git clone git://git.samirparikh.com/cgi-dev
Log | Files | Refs | README

oo_hw.cgi (850B) - raw


      1 #!/usr/bin/perl
      2 
      3 use strict;
      4 use warnings;
      5 use CGI;
      6 my $cgi = CGI->new;
      7 #chomp (my $name = <>);
      8 #print "hello, $name\n";
      9 my $path = $cgi->path_info();
     10 #my $accept_formats = $cgi->Accept;
     11 print   $cgi->header(),
     12         $cgi->start_html(),
     13 	$cgi->p("Hello World"),
     14         $cgi->p("my cgi->query_string is ", $cgi->query_string()),
     15         $cgi->p("my QUERY_STRING is ", $ENV{ QUERY_STRING }),
     16         $cgi->p("my Accept is ", $cgi->Accept);
     17 
     18 print $cgi->p("These are the HTTP environment variables I received:");
     19 
     20 foreach ( $cgi->http ) {
     21     print $cgi->p($_, ": ", $cgi->http($_));
     22 }
     23 
     24 print $cgi->p("self_url is ", $cgi->self_url);
     25 
     26 print $cgi->p("These are the parameters I received:");
     27 
     28 foreach my $name ($cgi->param) {
     29     foreach my $value ( $cgi->param( $name ) ) {
     30         print $cgi->p($name, ": ", $value);
     31     }
     32 }
     33 
     34 print $cgi->end_html();