Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.1 KiB

  1. #!/usr/local/bin/perl
  2. use CGI;
  3. use CGI::Carp qw/fatalsToBrowser/;
  4. $query = new CGI;
  5. print $query->header;
  6. print $query->start_html("Example CGI.pm Form");
  7. print "<H1> Example CGI.pm Form</H1>\n";
  8. &print_prompt($query);
  9. &do_work($query);
  10. &print_tail;
  11. print $query->end_html;
  12. sub print_prompt {
  13. my($query) = @_;
  14. print $query->start_form;
  15. print "<EM>What's your name?</EM><BR>";
  16. print $query->textfield('name');
  17. print $query->checkbox('Not my real name');
  18. print "<P><EM>Where can you find English Sparrows?</EM><BR>";
  19. print $query->checkbox_group(
  20. -name=>'Sparrow locations',
  21. -Values=>[England,France,Spain,Asia,Hoboken],
  22. -linebreak=>'yes',
  23. -defaults=>[England,Asia]);
  24. print "<P><EM>How far can they fly?</EM><BR>",
  25. $query->radio_group(
  26. -name=>'how far',
  27. -Values=>['10 ft','1 mile','10 miles','real far'],
  28. -default=>'1 mile');
  29. print "<P><EM>What's your favorite color?</EM> ";
  30. print $query->popup_menu(-name=>'Color',
  31. -Values=>['black','brown','red','yellow'],
  32. -default=>'red');
  33. print $query->hidden('Reference','Monty Python and the Holy Grail');
  34. print "<P><EM>What have you got there?</EM><BR>";
  35. print $query->scrolling_list(
  36. -name=>'possessions',
  37. -Values=>['A Coconut','A Grail','An Icon',
  38. 'A Sword','A Ticket'],
  39. -size=>5,
  40. -multiple=>'true');
  41. print "<P><EM>Any parting comments?</EM><BR>";
  42. print $query->textarea(-name=>'Comments',
  43. -rows=>10,
  44. -columns=>50);
  45. print "<P>",$query->reset;
  46. print $query->submit('Action','Shout');
  47. print $query->submit('Action','Scream');
  48. print $query->endform;
  49. print "<HR>\n";
  50. }
  51. sub do_work {
  52. my($query) = @_;
  53. my(@values,$key);
  54. print "<H2>Here are the current settings in this form</H2>";
  55. foreach $key ($query->param) {
  56. print "<STRONG>$key</STRONG> -> ";
  57. @values = $query->param($key);
  58. print join(", ",@values),"<BR>\n";
  59. }
  60. }
  61. sub print_tail {
  62. print <<END;
  63. <HR>
  64. <ADDRESS>Lincoln D. Stein</ADDRESS><BR>
  65. <A HREF="/">Home Page</A>
  66. END
  67. ;
  68. }