原文:
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)