Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.ru/~svit/full_CGI1.cgi
Дата изменения: Wed Jul 9 19:27:47 2008
Дата индексирования: Mon Oct 1 23:52:05 2012
Кодировка:
#!/usr/bin/perl

use CGI;

$query = new CGI;

print $query -> header;
print $query -> start_html("My first full example");
print "\n \n";
print "\n";
print "\n";
print "\n
\n

My first full page created with CGI

";
print_prompt($query);
do_work($query);
&print_tail;
print $query -> end_html();


sub print_prompt{
my($query) = @_;
print $query->startform;

print "What is your name?
";
print $query->textfield('name');
print $query->checkbox('It is my nickname');
print "

Where is it possible to see ENGLISH sparrow?
";
print $query->checkbox_group(
-name=>'Sparrow location',
-values=>[England, Holland, France, Spain, Russia],
-linebreak=>'yes',
-defaults=>[Holland]);
print "

How long could they fly?
";
print $query->radio_group(
-name=>'how_far',
-values=>['1 meter', '1 mile', '10 miles', 'realy far'],
-default=>'1 meter');
print "

What is your favourite color?
";
print $query->popup_menu(
-name=>'Color',
-values=>['black', 'brown', 'red', 'yellow', 'white'],
-default=>'red');
print $query->hidden('Reference', 'Monty Python');
print "

What have you got there?
";
print $query->scrolling_list(
-name=>'possesions',
-values=>['Sword', 'Axe', 'Knife', 'Ticket','Car','Mouse', 'Dog', 'Sheep', 'Computer', 'Door', 'Rabbit'],
-size=>5,
-multiple=>'true');
print "

Any parting comments?
";
print $query->textarea(
-name=>'Comments',
-rows=>10,
-columns=>50);
print "

", $query->reset;
print $query->submit('Action','Submit');
print $query->submit('Action','Screem');
print $query->endform;
print "


\n";

}

sub do_work{
my($query)=@_;
my(@values,$key);
print "

Current values of this form:

";
foreach $key ($query->param){
print "$key";
@values = $query->param($key);
print join(", ", @values), "
\n";
}
}


sub print_tail {
print "

Lincoln D. Stein

"
}

1;