📄 01_4_12_3.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="ccwlogo5.gif"></td></tr>
<tr><td height="27" valign=top><img src="knowledl.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="top00005.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="topbannj.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>
<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">第五节 OOP面向对象的程序之为编译而设计</font></b></td></tr></table><table align=center width=620><tr><td class=a14>
面向对象的程序设计已经不是什么新颖的话题和技术了。它在C++和Java中,尤为重要,哎,我觉得在写大宗程序的时候会很有帮助,但是在小程序里面反而麻烦,还不如普通的函数使用。OOP大多数基本的Perl教程都有说明,所以这里也不多讲“废话”,主要讲述OOP在编译Perl程序中的应用以及Perl OOP编写的技巧,所以值得一看。</td></tr></table><table align=center width=620><tr><td class=a14>
前面说过在PerlCC编译可执行程序的时候,不要使用require函数,这是没有错的。但是有很多人写require习惯了,而且不经常接触OOP模式,所以不习惯。</td></tr></table><table align=center width=620><tr><td class=a14>
其实使用use比require 好很多,还有很多人用require引入变量,这是大大错误,这是一种程序上编写的失误,所以建议以后大家不要用这种方式。编译的时候也不要用这种放式?那么用什么方式?如果你是一个有经验的Perl程序员,你应该知道。使用OPEN函数,传送变量值。这是编译Perl程序的关键,一些定量(不变的量),最好放在程序内部,变量以及客户所需要设置的量使用我先前说的那种方式。具体实践方法:</td></tr></table><table align=center width=620><tr><td class=a14>
<table border="1" width="100%">
<tr>
<td width="100%" colspan="2" bgcolor="#C0C0C0"><span lang="FR" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:
1.0pt;mso-ansi-language:FR;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA">Tanshuai
OpenConf </span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;
mso-ansi-language:FR;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA">函数代码:</span></td>
</tr>
<tr>
<td width="16%">
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">L.1<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">2<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">3<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">4<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">5<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">6<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">7<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">8<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">9<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">10<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">11<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">12<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">13</span></td>
<td width="84%">
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">sub Open_Conf {<o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-tab-count:1">
</span>open(FILE, "$_[0]");#</span><span style="font-size:9.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman";mso-ansi-language:FR">打开~调用函数的文件名</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-tab-count:1">
</span>my @Conf_Info = <FILE>;#</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">赋予~文件内容到</span><span lang="EN-US" style="font-size:9.0pt;
mso-bidi-font-size:12.0pt">@Conf_Info</span><span style="font-size:9.0pt;
mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">数组中</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-tab-count:1">
</span>close(FILE);#</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman";mso-ansi-language:
FR">关闭</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt">~</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman";mso-ansi-language:
FR">文件</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal" style="margin-left:3.6pt;text-indent:-3.6pt;mso-char-indent-count:
-.4;mso-char-indent-size:9.0pt"><span lang="EN-US" style="font-size:9.0pt;
mso-bidi-font-size:12.0pt"><span style="mso-spacerun: yes">
</span>my $Conf_Infos ;</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">定义</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt">~</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">局部变量</span><span lang="EN-US" style="font-size:9.0pt;
mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-tab-count:1">
</span>foreach $Conf_Infos (@Conf_Info) {#</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman";mso-ansi-language:FR">循环</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-spacerun: yes"> </span><span style="mso-tab-count:
2"> </span>($name,
$value) = split(/=/, $Conf_Infos);#</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">区分~名称和数值</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
12.0pt"><span style="mso-spacerun: yes"> </span><span style="mso-tab-count:
2"> </span>($value,
$dot) = split(/;/, $value);#</span><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">区分~结束符</span><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:12.0pt"><o:p>
</o:p>
</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;mso-bidi-font-size:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -