王朝网络
分享
 
 
 

Perl/TkFAQ-2.Perl/Tk和Tkperl有什么区别?

王朝perl·作者佚名  2008-05-18
宽屏版  字体: |||超大  

原文:

2. What is the difference between perl/Tk and Tkperl?

[OBSOLETE; move to historical section.] TkPerl was originally the name of a (now unsupported) perl 4 package that Malcolm Beattie mailto:mbeattie@sable.ox.ac.uk at Oxford University gave to his code to wed the Tk X toolkit with Perl. (He has since referred to that package as a different "kettle of fish" from perl/Tk.)

Since that beginning Malcolm has also come up with a Tcl module for perl 5 that has a Tcl::Tk module extension. That module allows the use of Tcl within a Perl script (i.e. you must know both languages to get your widgets to work.) If you are interested in that package instead, see the necessary kits for Malcolm Beattie's Tcl/Tk extensions to Perl, which have been distrubuted as Tcl-b#.tar.gz and TclTk-b#.tar.gz files in the authors/id/MICB/ directory at CPAN sites (locations given in a separate question in this FAQ).

The name "tkperl" is sometimes applied to the "perl/Tk" or "ptk" package that is the subject of this FAQ. Nick Ing-Simmons prefers "perl/Tk" as the name of the package, with "pTk" or "ptk" as contractions of that name as well as referring to something technically distinct: given the extensibility of the pTk code the "p" could also be taken to mean 'portable' or 'pure' (not to be confused with either the Helsinki University of Technology portTk, nor with Brian Warkentine's Rivet). In this document the code of interest is either referred to as "perl/Tk", "pTk", or "ptk" though the primary focus is on perl/Tk.

Warning: do not attempt to install both perl/Tk and Tcl/Tkperl in the same perl installation. The names in the respective modules overlap. In particular the Tcl::Tk module is declared in a Tk.pm file - so a statement like:

use Tk;

will probably confuse your perl. If you cannot live without either module then install make & maintain separate perls for each and arrange your script writing accordingly (this will not be easy).

A more extensive comparison of the differences between the Tkperl and the perl/Tk code is given in the Tcl-perl.pod file that is distributed with perl/Tk (see the following questions for locations).

Lastly, it should be mentioned that if you build your perl/Tk statically rather than dynamically it will make a new perl interpreter called tkperl (confusing isn't it? :-).

译文:

2. Perl/Tk和Tkperl有什么区别?

TkPerl最初是牛津大学的Malcolm Beattie为了把Tk X工具箱结合到Perl中去,而为Perl4开发的一个的包(package)的名字。(但是他现在已经不再提供支持了……)

从那以后Malconlm也为Perl5做了一个Tcl的模块叫做Tcl::Tk,这个模块允许在Perl脚本中直接使用Tcl语言(这也就意味着你必须同时懂得这两种语言!)。如果你实际是对那个模块感兴趣的话,可以查阅相关的资料。Malcolm Beattie为Perl做的Tcl/Tk扩展模块在CPAN站点的authors/id/MICB/目录中,文件名是Tcl-b#.tar.gz和TclTk-b#.tar.gz。

Perl/Tk (或ptk)作为我们这个“常见问题”文档的主题,在有些情况下也会被称为“tkperl”。但是,作者Nick Ing-Simmons还是希望用“Perl/Tk”作为这个模块的名字,而把“pTk”或是“ptk”作为简称,因为这个简称可以同时暗示出这个模块一些技术特点:可扩展性——也就是说这里的“p”可以理解为是“便携式的”(portable)或者“纯粹的”(pure)。(但是请不要和芬兰赫尔辛基技术大学的portTk及Brian Warkentine的Rivet混淆!)本文档的代码主要是集中在Perl/Tk,但是也会涉及pTk或ptk。

警告:不要试图在同一个Perl环境中安装Perl/Tk和Tcl/Tkperl,因为这两个模块的名字是有重叠的。特别是Tcl::Tk模块也包含在一个叫Tk.pm的文件中,因此如下的语句:

use Tk;

将可能会令你的Perl解释器不知所措(译者注:使用Perl/Tk模块也需要用同样的语句)。如果你必须同时安装这两个模块,那么只能是在你的系统中同时安装两个相互独立的Perl环境,然后分别安装相应的模块,并且根据需要编写你的脚本。(这样做并不容易哟!)

关于Tkperl和Perl/Tk之间的区别,Perl/Tk包中的Tcl-perl.pod文件里有更加详细的比较说明。(具体位置参阅下面问题的内容)

最后,必须说明的是,如果你是静态的而不是动态的构建你的Perl/Tk,那么这将产生出一个新的名叫“tkperl”的Perl解释器。(这下晕了吧?:-P)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有