perl-cgi基础
来源:
http://www.cnblogs.com/itech/archive/2012/09/22/2698553.html
代码: http://xxxxx/cgi/perl-cgi.cgi?name=itech&url=itech.cnblogs.com&p1=test1
#!/usr/bin/perl -wT
#should use strict and warnning
use warnings;
use strict;
use CGI;
#to debug error
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
#or debug from command line by : perl -cwT yourcgi.cgi
#or debug by : tail /var/log/apache/error_log
#make sure yourcgi.cgi is world excutable or 755 permission #just include sub features of cgi, standard means, 'html2', 'html3', 'html4', 'form' and 'cgi'.
#use CGI qw(:standard); #must define and initialize
my $p1='';
my $p2='';
my $name='';
my $url='';
my $q = new CGI;
$p1 = $q->param('p1') if $q->param('p1');
$p2 = $q->param('p2') $q->param('p2') ;
$name = $q->param('name') $q->param('name') ;
$url = $q->param('url') $q->param('url'); print $q->header();
print $q->start_html(-title=>"Hello World"); print "p1:$p1<br>";
print "p2:$p2<br>";
if(!defined($p2)){print "p2 is not defined<br>";}
if($p2 eq ""){print "p2 is empty<br>";} print <<EndHTML;
<h2>Hello</h2>
<p>
My name is $name, and my web url is
<a href="$url">$url</a>.
</p>
EndHTML $q->h3('welcome to here!<br>');
print "$ENV{REMOTE_ADDR}<br>";
print $q->end_html();
完!
perl-cgi基础的更多相关文章
- Perl CGI编程
http://www.runoob.com/perl/perl-cgi-programming.html 什么是CGI CGI 目前由NCSA维护,NCSA定义CGI如下: CGI(Common Ga ...
- 《Apache服务之php/perl/cgi语言的支持》RHEL6——服务的优先级
安装php软件包: 安装文本浏览器 安装apache的帮助文档: 测试下是否ok 启动Apache服务关闭火墙: 编辑一个php测试页测试下: perl语言包默认系统已经安装了,直接测试下: Apac ...
- perl脚本基础总结
1. 单引号字符串中的\n不会被当做换行符处理. 如:'\'\\' --> '\ . 2. 双引号 字符串联 "Hello"."World" ...
- Perl 语法 - 基础
perl语言的核心是正则表达式,在文本处理上非常有优势,与python类似,但语法不同,perl的语法很灵活,用多了才会觉得好用. 常用知识点总结: perl语法类似于C语言(perl源于Unix), ...
- Perl 编程 基础用法
Perl 编程 标准头部写法 #!/usr/bin/perl -w # 标准的头部写法,-w意为显示警告 变量 $a=$b+10 # $a和$b都不需要定义,拿过来就用 Note: $flag=0 如 ...
- Perl & Python编写CGI
近期偶然玩了一下CGI,收集点资料写篇在这里留档. 如今想做HTTP Cache回归測试了,为了模拟不同的响应头及数据大小.就须要一个CGI按须要传回指定的响应头和内容.这是从老外的測试页面学习到的经 ...
- Perl的调试方法
来源: http://my.oschina.net/alphajay/blog/52172 http://www.cnblogs.com/baiyanhuang/archive/2009/11/09/ ...
- Linux基础命令-查看基本硬件信息
Linux基础命令-查看基本硬件信息 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.查看CPU信息 [root@node101.yinzhengjie.org.cn ~]# l ...
- Perl系列文章
0.Perl书籍推荐 Perl书籍下载 密码:kkqx 下面是一些我学习Perl过程中读过完整的或部分章节的觉得好的书. 入门级别1:<Perl语言入门>即小骆驼 入门级别2:<In ...
- Perl语言入门
Perl 是 Practical Extraction and Report Language 的缩写,可翻译为 "实用报表提取语言". Perl语法基础: (1)Perl程序由声 ...
随机推荐
- redis 5 种数据结构
常用命令 就DB来说,Redis成绩已经很惊人了,且不说memcachedb和tokyocabinet之流,就说原版的memcached,速度似乎也只能达到这个级别.Redis根本是使用内存存储,持久 ...
- nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
环境:Centos6.5 行为:安装nginx 问题: nginx: [emerg] socket() [::]: failed (: Address family not supported by ...
- GOPS 2016全球运维大会 • 北京站概况
GOPS 2016全球运维大会上海站已圆满落幕,错过上海站的朋友或许会感到一些遗憾,但是不用担心,在12月16日,GOPS 2016全球运维大会 • 北京站将隆重召开,错过上海在的朋友可以赶上北京站哦 ...
- YII使用PHPExcel导入Excel文件的方法
1.下载phpexcel,将压缩包中的classes复制到protected/extensions下并修改为PHPExcel. 2.修改YII配置文件config/main.php 'import'= ...
- java 截屏 类似于 QQ截屏
package com.sun.test; import java.awt.AWTException;import java.awt.BorderLayout;import java.awt.Colo ...
- 【转】js获取url传递参数
<Script language="javascript">var Request = new Object();Request = GetRequest();var ...
- 使用Idea作为go的IDE
Idea是一款非常不错的IDE,只可惜是收费的.Idea可以使用很多的插件,当然里面就包含我们需要的go语言的插件. 1.我们打开file -> Settings -> Plugins - ...
- Wsyscheck(系统检测维护工具) v1.68.33绿色版
软件名称:系统检测维护工具(Wsyscheck) v1.68.33绿色版软件类别:国产软件运行环境:windows软件语言:简体中文授权方式:免费版软件大小:1022 KB软件等级:整理时间:2011 ...
- Mac 必备软件 Quicksilver
http://www.xdanger.com/2007/03/30/000067.html
- Linux通过XAMPP集成软件包搭建LAMPP环境
前面介绍过一篇“Linux手动搭建LAMP环境”,今天再来整理一篇“Linux通过XAMPP集成软件包搭建LAMPP环境”. 其实当初整理通过XAMPP集成软件包搭建LAMPP环境的原因是这样的: 自 ...