Perl on windows platform
ActivePerl
http://www.activestate.com
Installation
http://www.activestate.com/activeperl/downloads
Perl Binaries:
ActivePerl-5.14.2.1402-MSWin32-x86-295342.msi
Suppose you install ActivePerl under below dir:
D:\usr\bin\Perl\Perl5.14.2
Configuration ActivePerl on windows platform
If you do not select the option to set the installation direction into env %PATH%,
you need do something belows additional:
set %PATH% = %PATH%;D:\usr\bin\Perl\Perl5.14.2\bin;D:\usr\bin\Perl\Perl5.14.2\site\bin;
Test
>perl
D:\home\admin\workstation\perl>perl
>perl -version
D:\home\admin\workstation\perl>perl -version
This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:49:44
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
>ppm
see Diagram 1,2
Installation - DBI module
ppm
command to open Perl Package Manager tool.
ppm provides gui tool to install perl packages.
or
ppm install DBI
Installation - DBD MYSQL
ppm
or
ppm install DBD-mysql
例子
# # Program to calculate the circumference of circle # The constant variable of PI $pi = 3.14159265; # This section is to calculate the circumference of circle # (whose radius is 12.5) $radius = 12.5; $cc = 2*$pi*$radius; print $cc; print "\n"; print "The circumference of circle(radius=$radius): $cc\n"; print "The circumference of circle(radius=".$radius."): ".$cc."\n"; # This section is to calculate the circumference of circle, # which the radius of circle inputed from termine by user. # So, pls enter the radius of circle while "Pls input the radius of circle". # User can exit the program by click <ENTER> key. print "Pls input the radius of circle:"; while ($radius = <STDIN>) { if ($radius eq "\n") { print "exit"; last; } if ($radius < 0) { print "Warn: The radius of circle can not be less than zero(0)\n"; $cc = 0; } else { $cc = 2*$pi*$radius; } print "The circumference of circle(radius=".$radius."): ".$cc."\n"; #continue yes/no print "Pls input the radius of circle:"; }
Another Perl Practice(ActivePerl On Window Platform)
$count = 5; $ss = "12345"; print "$ss\n" x $count; print "--------------------------\n"; print "Pls input a string: "; $ss = <STDIN>; print "Pls the count of string to display: "; $count = <STDIN>; print "$ss\n" x $count; print "--------------------------\n"; while (1) { print "Pls input a string: "; $ss = <STDIN>; if ($ss == "\n") { print "exit"; last; } print "Pls the count of string to display: "; while ($count = <STDIN>) { if ($count != "\n") { last; } print "Pls the count of string to display: "; } print "$ss\n" x $count; print "--------------------------\n"; }
One Perl Practice With Database MYSQL
mysql_select.pl:
use strict;
use DBI;
#my($dbh) = DBI->connect("DBI:mysql:it-community", "root", "jxcoco1128", "") or die "can't connect!\n";
my $dbh = DBI->connect("DBI:mysql:database=it-community;host=localhost", "root", "jxcoco1128", {'RaiseError'=>1});
my $sql = "select * from micro_blogging";
my $sth = $dbh->prepare($sql);
$sth->execute();
print "======================================================================================================================\n";
#
while (my @array=$sth->fetchrow_array())
{
printf("%-35s", $_) foreach(@array);
print "\n----------------------------------------------------------------------------------------------------------------------\n";
};
print "======================================================================================================================\n";
$dbh->disconnect();
exit 0;
perl mysql_select.pl:
D:\home\admin\workstation\perl>perl mysql_select.pl
======================================================================================================================
1 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
10 微博信息 描述内容 用户名
----------------------------------------------------------------------------------------------------------------------
2 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
3 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
4 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
5 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
6 c1 d1 u1
----------------------------------------------------------------------------------------------------------------------
7 c1 d1 用户名
----------------------------------------------------------------------------------------------------------------------
8 微博信息 描述内容 用户名
----------------------------------------------------------------------------------------------------------------------
9 微博信息 描述内容 用户名
----------------------------------------------------------------------------------------------------------------------
======================================================================================================================
Example of front end web development base perl
#!D:/usr/bin/Perl/Perl5.14.2/bin/perl.exe
use strict;
use DBI;
use CGI;
my $q = new CGI;
#my $q = CGI->new;
my $topicID = $q->param('id');
print "Topic ID: $topicID\n";
print "Content-type: text/plain; charset=GBK\n\n";
#my($dbh) = DBI->connect("DBI:mysql:it-community", "root", "password", "") or die "can't connect!\n";
my $dbh = DBI->connect("DBI:mysql:database=it-community;host=localhost", "root", "password", {'RaiseError'=>1});
$dbh->do("SET character_set_client = 'gbk'");
$dbh->do("SET character_set_connection = 'gbk'");
$dbh->do("SET character_set_results= 'gbk'");
my $sql = "select uuid, comments, submitter, UNIX_TIMESTAMP(timestamp) creation_timestamp from topic_tie where topic_id='".$topicID."'";
my $sth = $dbh->prepare($sql);
$sth->execute();
# print "======================================================================================================================\n";
# <tr>
# <td>楼主</td>
# <td>
# <div style="width: 100%; border-radius: 6px 6px 6px 6px; -moz-border-radius: 6px 6px 6px 6px; border: 1px solid silver;">
# <div style="height: 28px; width: 100%; border-radius: 6px 6px 0px 0px; -moz-border-radius: 6px 6px 0px 0px; border: 1px solid silver;">
# <span style="line-height: 28px;"><label>标题:</label></span>
# </div>
# <div style="height: 28px; width: 100%; border-radius: 0px 0px 6px 6px; -moz-border-radius: 0px 0px 6px 6px; border: 1px solid silver;">
#
# </div>
# </div>
# </td>
# </tr>
# <tr>
# <td width="150"></td>
# <td><a href="">回复主题</a></td>
# </tr>
#while (my @array=$sth->fetchrow_array())
#{
# printf("%-35s", $_) foreach(@array);
# print "\n----------------------------------------------------------------------------------------------------------------------\n";
#};
my $ttt = time();
while (my $ref = $sth->fetchrow_hashref()) {
print ("<tr>\n");
print "<td>\n";
print "$ref->{'deliver'}\n";
print "</td>\n";
print "<td>\n";
print "<div style='width: 100%; border-radius: 6px 6px 6px 6px; -moz-border-radius: 6px 6px 6px 6px; border: 1px solid silver;'>\n";
print "<div style='height: 28px; width: 100%; border-radius: 6px 6px 0px 0px; -moz-border-radius: 6px 6px 0px 0px; border: 1px solid silver;'>\n";
print "<span style='line-height: 28px;'>\n";
print "<label>\n";
print "标题:\n";
my $_id = $ref->{'uuid'};
my $_timestamp = $ref->{'creation_timestamp'};
my $temp = $_timestamp + 86400;
#print ("</tr>$_timestamp $temp $ttt\n");
if ($temp >= $ttt) {
print ("<img src='images/new_icon.gif' title='最新论坛主题!'/>");
}
print "<a href='tp.shtml?id=".$_id."'>".$ref->{'name'}."</a>(于$ref->{'last_updatetime'}更新)\n";
print "</label>\n";
print "</span>\n";
print "</div>\n";
print "<div style='height: auto; width: 100%; border-radius: 0px 0px 6px 6px; -moz-border-radius: 0px 0px 6px 6px; border: 1px solid silver;'>\n";
print "$ref->{'comments'}\n";
print "</div>\n";
print "</div>\n";
print "</td>\n";
print ("</tr>\n");
print "<tr>\n";
print "<td width='150'></td>\n";
print "<td><a href=''>主页</a>|<a href=''>资料</a>|<a href=''>短信</a>|<a href=''>留言</a>|<a href=''>关注</a> <a href=''>好</a>|<a href=''>差</a> <a href=''>引用</a>|<a href=''>收藏</a></td>\n";
print "</tr>\n";
}
# while (my $ref = $sth->fetchrow_hashref()) {
# print "uuid: $ref->{'uuid'}\n";
# print "commects: $ref->{'comments'}\n";
# print "descr: $ref->{'descr'}\n";
# print "username: $ref->{'username'}\n";
# print "------------\n";
#}
# print "======================================================================================================================\n";
$dbh->disconnect();
exit 0;
相关推荐
草莓perl安装包下载,新版本 Strawberry Perl是用于MS Windows的perl环境,其中包含运行和开发perl应用程序所需的一切。 它被设计为尽可能接近UNIX系统上的perl环境。 它包括perl二进制文件,编译器(gcc)+相关...
windows Strawberry Perl 5.32最新版本 ,适合调试 perl windows Strawberry Perl 5.32最新版本 ,适合调试 perl windows Strawberry Perl 5.32最新版本 ,适合调试 perl windows Strawberry Perl 5.32最新版本 ...
perl脚本perl脚本perl脚本perl脚本
Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0版本,Perl-5.10.0...
windows环境的perl安装包,不用去官网下载了,测试好用。 strawberry-perl-5.32.1.1-64bit.msi离线安装包(官方),可避免从官网下载速度慢的问题。 windows环境的perl安装包,不用去官网下载了,测试好用。 ...
装mysql时提示少perl,安装perl需要依赖包。已包含下面所有包, 版本号匹配。 [Linux]centOS7下RPM安装Perl 下载rpm依赖包,依照顺序安装. perl-parent-0.225-244.el7.noarch perl-...
pt-query-digest是一个perl语言编写的脚本,windows环境默认不支持perl,因此需要安装perl脚本的依赖程序。 1、从官网下载草莓perl(完全开源) http://strawberryperl.com/ 2、从此处下载国内镜像
Perl is a high-level programming language with roots in C, sed, awk and shell scripting. Perl is good at handling processes and files, and is especially good at handling text. Perl's hallmarks are ...
The only book to cover this important tool, Perl Template Toolkit is essential reading for any Perl programmer who wants to create dynamic web content that is remarkably easy to maintain. This book is...
ActivePerl-5.28.1 win10 x64离线安装包(官方),可避免从官网下载速度慢的问题。 ActivePerl-5.28.1 win10 x64离线安装包(官方),可避免从官网下载速度慢的问题。 ActivePerl-5.28.1 win10 x64离线安装包(官方...
windows环境的perl安装包,不用去官网下载了,测试好用。 strawberry-perl-5.32.1.1-32bit.msi离线安装包(官方),可避免从官网下载速度慢的问题。 windows环境的perl安装包,不用去官网下载了,测试好用。 ...
ActivePerl-5.8.0.806-MSWin32-x86.msi,perl的安装程序,Perl是一种通用编程语言。凡是其他编程语言能够使用的地方,都有它的用武之地。在各行各业中,它已经被用于你能够想像到的各种各样的任务的处理。它已经用于...
其包含了包括有 Perl for Win32、Perl for ISAPI、PerlScript、Perl Package Manager四套开发工具程序,可以让用户编写出适用于unix,windows,linux系统的CGI程序来。 安装的只是perl的一个解释程序啦,外观上也...
其包含了包括有 Perl for Win32、Perl for ISAPI、PerlScript、Perl Package Manager四套开发工具程序,可以让用户编写出适用于unix,windows,linux系统的CGI程序来。 CGI(Common Gateway Interface)公共网关...
Perl 最初的设计者为拉里·沃尔(Larry Wall),他于1987年12月18日发表。Perl借取了C、sed、awk、shell scripting以及很多其他程序语言的特性。其中最重要的特性是它内部集成了正则表达式的功能,以及巨大的第三方...
win7+bugzilla+apache+mysql+activePerl环境安装bugzill时: Perl安装 安装: 将ActiveState Perl 安装到C:/Perl64 或C:/Perl 最好是5.16版本,ActivePerl-5.16.3.1604-MSWin32-x64-298023.msi 安装 Modules(下面...
PERL语言编程 Perl 是一种能完成任务的语言。 <br/>当然,如果你的工作就是写程序,那么从理论上来讲,你可以使用任何“完整”的计算机语言来完成任务。但是从我们的经验来看,计算机语言的区别很大程度上...
本书循序渐进、深入浅出地介绍了Perl的主要特性及用Perl进行CGI编程的知识。全书包括24个学时内容和一个附录,共分四部分。第一部分主要讲述Perl的基本概念,第二部分重点介绍Perl的一些高级特性,第三部分介绍如何...
Perl语言编程
Perl语言学习