📄 01_4_11_6.asp.html
字号:
<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>计算机世界网-Perl 语言全面编译(三)</TITLE></HEAD>
<style>
.a14{font-size:14px;text-indent:25px;line-height:20px}
.f{font-size:18px;color=#0f3ccd}
img{border:0px;}
td,p,input{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>
<center>
<BODY topmargin=2 leftmargin=0>
<style>
.v12{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>
<style>
.v13{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v12{font-size:13px;color:"#4C029C";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>
<!--头-->
<table align=center cellpadding="0" cellspacing="0" border="0" width="767">
<tr><td valign=bottom>
<table cellpadding="0" cellspacing="0" border=0>
<tr><td valign=top><img src="ccwlogo2.gif"></td></tr>
<tr><td height="27" valign=top><img src="knowledi.gif" width="207" height="27"></td></tr>
</table></td>
<td valign=bottom width=556 bgcolor="#4c029c" height=96>
<table cellpadding="0" cellspacing="0" border=0 width=556 bgcolor="#4c029c" height=96>
<tr><td height=25 valign=bottom bgcolor="#ffffff" colspan=2 ><img src="top00002.gif" usemap="#F"></td></tr>
<tr valign=middle >
<td align=center valign=middle height="60" align=center>
<!-- <a href="/search/" target=_blank><img src="/img2/esearch.GIF" border=0 width=468 height=60></a> --><a href="http://www.ccw.com.cn/html/search/thememail/" target=_blank><img src="topbanng.gif" border=0 width=468 height=60></a>
</td>
<td align=center width=15%>
<table width=95%>
<tr><td><a href="mailto:center@ccw.com.cn?subject=%E6%88%91%E8%A6%81%E6%8A%95%E7%A8%BF:" target=_blank><font class=v13>我要投稿</a><br><a href="mailto:center@ccw.com.cn?subject=%E7%BC%96%E8%AF%BB%E5%BE%80%E6%9D%A5"><font class=v13>编读往来</a><br><a href="javascript:AddBookMark('计算机世界网首页')"><font class=v13>加入收藏</a></font></td></tr>
</table>
</td>
</tr>
<tr><td bgcolor="#ffffff" height=1 colspan=2 ></td></tr>
<tr><td bgcolor="#b4aafc" height=2 colspan=2 ></td></tr></table>
<map name="F">
<area href="http://www.ccw.com.cn/" shape="rect" coords="29, 3, 61, 18" target=_blank>
<area href="http://www.ccw.com.cn/news1/" shape="rect" coords="72, 3, 143, 18" target=_blank>
<area href="http://www.ccw.com.cn/center/" shape="rect" coords="155, 2, 216, 18" target=_blank>
<area href="http://www.ccw.com.cn/work/" shape="rect" coords="225, 2, 299, 18" target=_blank>
<area href="http://www.ccw.com.cn/search/" shape="rect" coords="310, 3, 364, 19" target=_blank>
<area href="http://www3.ccw.com.cn/" shape="rect" coords="372, 2, 412, 19" target=_blank>
<area href="http://www2.ccw.com.cn/" shape="rect" coords="424, 2, 550, 18" target=_blank></map>
</td></tr>
<tr><td colspan=2 bgcolor="#b4aafc">
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td width=26% align=center><font class=v12>【2003年2月7日】 </font></td>
<td CLASS=V12> <a href="http://www.ccw.com.cn/center/topic.asp">专 题</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/tech.asp">技 术</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/prod.asp">产 品</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/app.asp">应 用</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/net.asp">网 络</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/prog.asp">编 程</a> /</td>
<td CLASS=V12><a href="http://www.ccw.com.cn/center/skill.asp">技 巧</a> </td>
</tr>
</table>
</td></tr>
</table>
<table align=center width=680>
<tr><td align=center><br><h2><font color='#0f3ccd'>Perl 语言全面编译(三)</font></h2>
<br><b><a href="mailto:tanshuai@BIGFOOT.COM"><font color="#0000FF">天水-S.Tanshuai</font></a></b>
<br><hr size=1 width=660 color=#f46240></td></tr></table><br>
<table align=center width=620><tr><td class=a14><b><font size="4">第三节 PerlCC 编译方法</font></b></td></tr></table><table align=center width=620><tr><td class=a14>
PerlCC是Perl的最好最优秀最强的得编译器,而且是免费的。但是它的调试与运作是比较方“烦”人的。特别是在微软的Windows就更令人头疼。</td></tr></table><table align=center width=620><tr><td class=a14>
PerlCC编译器的原理是分析Perl原代码,然后根据标准转换方式,转换成C语言,当然这里的C全部采用Perl的头文件(Header),也就是全部采用Perl的函数,即使你只有一行的 “print “hello world”;”都需要无数行的定义后才会出现这样的效果。但是令人惊奇的是perl编译后的这个“hello world”比C/C++的编译后的可执行文件还要小。采用PerlCC转换出来的C源代码几乎是不可读(不可理解)的,几乎比汇编语言还令人费解。所以这样的程序即使被反编译出来,它的源代码也是会令人无法琢磨,但是这种程序根本几乎无法反编译,至少目前是,我相信只要Windows未被反编译那么它编译出来的Perl可执行程序也同样无法反编译。</td></tr></table><table align=center width=620><tr><td class=a14>
如果使用PerlCC是大家最关心的事情,在Unix-Style系统是,凡是安装perl5.0以上版本的都可以使用PerlCC,编译程序,但是必须有C编译器。这个我就不必太多说了。因为这个方法不大适合初学者,一般中级程序员对Unix-Style系统应该是较为了解的。</td></tr></table><table align=center width=620><tr><td class=a14>
在Windows中,一定要安装VC6.0(也可以是GCC,但是安装复杂)否则仍然无法编译,安装VC6.0是简单的事情,只要找到微软VC6的光盘,安装。</td></tr></table><table align=center width=620><tr><td class=a14>
然后,下载Perl源代码(地址:<a href="http://ftp.tanshuai.net/pub/"><font color="#0000FF">http://ftp.tanshuai.net/pub/</font></a> ),下来后解开压缩(Windows可以用Winzip)。</td></tr></table><table align=center width=620><tr><td class=a14>
UNIX-Style 命令行模式下:</td></tr></table><table align=center width=620><tr><td class=a14>
#cd <文件解压缩后的目录></td></tr></table><table align=center width=620><tr><td class=a14>
#make</td></tr></table><table align=center width=620><tr><td class=a14>
#make test ~可选</td></tr></table><table align=center width=620><tr><td class=a14>
#make install ~完成安装</td></tr></table><table align=center width=620><tr><td class=a14>
#export PATH=$PATH;/<安装目的目录路径>; ~设置变量</td></tr></table><table align=center width=620><tr><td class=a14>
Windows 命令行(Command.com CMD.COM)模式下:</td></tr></table><table align=center width=620><tr><td class=a14>
C:\>cd <文件解压缩后的目录\win32></td></tr></table><table align=center width=620><tr><td class=a14>
C: <文件解压缩后的目录\win32\> nmake</td></tr></table><table align=center width=620><tr><td class=a14>
C: <文件解压缩后的目录\win32\> nmake test ~可选</td></tr></table><table align=center width=620><tr><td class=a14>
C: <文件解压缩后的目录\win32\> nmake install</td></tr></table><table align=center width=620><tr><td class=a14>
Windows 95/98/Me 在 AutoExec.Bat文件中设置路径。</td></tr></table><table align=center width=620><tr><td class=a14>
Windows Nt/2000 在“控制面板”-〉“系统”-〉“高级”-〉“环境变量”中设置</td></tr></table><table align=center width=620><tr><td class=a14>
注意:千万不要使用AtivePerl,而且最好在安装标准编译Perl后,删除AtivePerl,AtivePerl“不支持”PerlCC,虽然它也有带perlcc 但是至少我是永远都无法编译成功的,我也不知道为什么,我也不想知道为什么,因为很多程序是在Unix-Style 上运作的,大多数都是标准Perl,所以建议大家为了兼容所有操作系统,请尽量用标准Perl编写和解析程序。</td></tr></table><table align=center width=620><tr><td class=a14>
好啦,一切安装、设置就绪后,重新启动计算机后。我们进入我们想要编译的文件目录中,输入“perlcc <程序名>”(注意:这里的程序扩展名称必须是.pl .bat .p .pm,.cgi也不行,你可以修改perlcc.bat文件来支持其它扩展名)。</td></tr></table><table align=center width=620><tr><td class=a14>
输入以上命令后,会出现一大堆你可能看不懂的命令(这些你并不需要关心)</td></tr></table><table align=center width=620><tr><td class=a14>
例如我要编译一个内容为:</td></tr></table><table align=center width=620><tr><td class=a14>
print “ok”;</td></tr></table><table align=center width=620><tr><td class=a14>
的Perl程序,该文件名:abc.pl。</td></tr></table><table align=center width=620><tr><td class=a14>
输入:</td></tr></table><table align=center width=620><tr><td class=a14>
perlcc abc.pl</td></tr></table><table align=center width=620><tr><td class=a14 bgcolor="#C0C0C0">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -