孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

可以用cgi对环境进行读取,直接用pint语句打印出来

#!d:/perl/bin/perl
use warnings;
use strict;

print "Content-type:text/html\n\n";
print "<HTML><HEAD><TITLE>Request Info</TITLE><HEAD> \n";

print "<BODY><BLOCKQUOTE><TABLE BORDER =1>\n";
foreach ('REQUEST_URI','REQUEST_METHOD','QUERY_STRING','PATH_INFO') {
 print "\t<TR><TD> $_ </TD><TD>'";
 print + (exists($ENV{$_}) and $ENV{$_})?$ENV{$_}:'Not provided';
 print "</TD></TR> \n";
}
print "</TABLE> \n";
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
 print "<BR><HR><BR> Request body:  \n";
 while (<>) {
  print "$.: $_ \n";
 }
}
print "</BLOCKQUOTE></BODY></HTML> \n";

用cgi编写表格

#!d:/perl/bin/perl
use warnings;
use strict;

use CGI::Pretty qw(:standard);

print header,start_html("Table Demo");

print table(Tr({-align=>'center',-valign=>'middle'},[
 td(['Tic','Tac','Toe','Tie']),
 td(['Red','Blue','Green','Yellow']),
 td({-colspan=>2},['Left','Right']),
 ]));
 
print end_html;

posted on 2011-05-13 22:38  孤独的猫  阅读(333)  评论(0编辑  收藏  举报