原文:
7. Where is the Documentation?
A great deal of Perl/Tk documentation gets installed as part of the Tk extension building process. Hence, a great deal of documentation is probably residing on your computer already.
More documentation is "in the works": there are several books dealing with perl/Tk in progress, an ongoing magazine column and a growing FAQ (the document you are presently reading).
The additional material you may want to look at can be split into Perl/Tk, Perl, Tcl/Tk, and X documentation categories: Perl/Tk Specific Documentation The man pages
With up to date Tk build kits the various perl/Tk pod documents are converted to your systems' helpfile format and installed as part of the perl/Tk "make install" process. If you have a recent verion of perl/Tk try something like man 3 Tk::Tk if this does not work check with you system administrator for the proper MANPATH.
In your Tk build directory there should be a doc/ sub-directory in which there are a number of .htm files (after you make install). These files were originally Tcl/Tk man pages (from the man* sub-directories), but the *.htm files have been converted to Perl syntax and rendered in HTML format. You can use the Perl/Tk web browser to view them locally with a command like: tkweb index.html
or you may view them on the web itself by installing them in a web-server directory tree, or by pointing a browser at: http://w4.lns.cornell.edu/~pvhp/ptk/doc/ The newsgroup
The newsgroup name is comp.lang.perl.tk and this FAQ will be periodically posted to that group (as well as a few other newsgroups). The newsgroup and/or the ptk mailing list are the appropriate places to post questions - yes even simple ones! (Although answers may sometimes be long in coming ... :-( The nTk/pTk mailing list
The mailing list is an excellent supplement and complement to the newsgroup comp.lang.perl.tk. All messages mailed to the list are forwarded to the newsgroup. (But not all messages posted to the newsgroup are forwarded to the list.) Some Perl/Tk experts only have access to e-mail.
The nTk/pTk Mailing List Archive is a very useful source of information too, and is accesible at either http://pubweb.bnl.gov/~ptk/
or via ftp at ftp://ftp.ccd.bnl.gov/pub/ptk/archives/
(both in the USA). You may search the contents of another ptk mailing list hypertext archive thanks to a cgi-bin script written by Achim Bohnet in Germany at: http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/
You must subscribe to the mailing list to receive e-mail from the list. To subscribe to the mailing list you can send mail to majordomo@lists.stanford.edu (i.e. mailto:majordomo@lists.stanford.edu) with the following command in the body of your e-mail message: subscribe ptk joe.user@somewhere (Joe D. User)
To send a message to all recipients of the mailing list send e-mail to mailto:ptk@lists.stanford.edu.
To remove yourself from the mailing list send e-mail to majordomo@lists.stanford.edu (i.e. mailto:majordomo@lists.stanford.edu) with the following command in the body of your e-mail message: unsubscribe ptk joe.user@somewhere (Joe D. User)
Where instead of "joe.user@somewhere" you might very well like to substitute another string of characters.
(Please note: one does not send unsubscribe messages to the ptk list. One does send "unsubscribe ptk" messages to a special e-mail list administration program. In the case of the ptk list you send to majordomo@lists.stanford.edu. You must of course do this from the account and computer from which you initially subscribed. In particular if you are viewing the hypertext version of this FAQ you may not be able to unsubscribe from majordomo@lists.stanford.edu by following the mailto: hyperlinks - if your web-browser account/computer is different from your subscribe to e-mail-lists account/computer (the details of this might depend on which browser you use though). Thank you for your cooperation on this.) The demo programs
Examine (and try running) the code in your Tk#/ build directory tree. You might also be interested in test-running the code that gets installed:
* or perl5/site_perl/Tk/demos/ or perl5/site_perl/Tk/demos/widget_lib/ directories (recent Tk's).
* Tk#/ or perl5/Tk/demos/ or perl5/Tk/demos/widget_lib/ directories (older versions e.g. Tk-b8).
In order to determine where on your system the perl5/ directory is located type the following one-line perl command (at your shell prompt - this is not a line from a perl script): perl -e 'print join("\n",@INC,"");'
If that command does not turn up a perl5/ directory then make sure that you are running perl 5 with the following: perl -v (this too can simply be entered at the shell prompt). More on the pod & man documentation
[As previously mentioned a great number of Tcl/Tk man pages are converted from *roff format to html format and are to be found within your Tk build directory tree in the doc/ sub-directory. These documents form an authoritative and extensive reference set for Perl/Tk.]
The raw pod files that come with the Tk kit are examples of the perl "plain old documentation" format and are just about human readable as they are (e.g. you may more, cat, or less them; or send them to a printer). Many (not all) of the perl/Tk pod documents get are converted to *roff format and are installed in you perl man page area as part of the perl/Tk build process.
If you have a recent version of perl/Tk try something like man 3 Tk::Tk. If this does not work check your manual page path with perl -MConfig -e 'print $Config{man1dir},"\n",$Config{man3dir},"\n"'
And if you still cannot find the manual pages check with your system administrator for the proper MANPATH and/or Tk installation version.
"Raw" .pod (such as UserGuide.pod) can be viewed with the tkpod hypertext pod viewer. Raw .pod may also be run through any one or more of a large numbers of re-formatting perl filters. Such programs include pod2man, pod2text, pod2html, pod2latex, etc. (these get installed when you install perl). Other translators pod2texinfo, pod2fm, pod2pdf, etc., also exist. Check a CPAN site for these scripts if you do not already have them.
A command line like the following (but subject to local variations) should work for you: tkpod site_perl/Tk/UserGuide.pod
or if you like Unix manual page style: pod2man perl5/Tk/UserGuide.pod | nroff -man | more
(note that I am showing examples with almost full file path names - the alternative would be to cd into the appropriate directory then type: pod2man UserGuide.pod | nroff -man | more
There should even be a perl script to run that above command for you. It is executed as: perldoc UserGuide
Note that if there is pod like documentation in a perl module you may also execute tkpod (or perldoc) on it as in: tkpod ColorEditor.pm
(please note that unfortunately, not all .pm mod files have pod embedded.)
If you have misplaced your tkpod program but still want that GUI look and feel (like xman) make the appropriate changes to the following script: #!/usr/bin/perl use Tk; use Tk::Pod; my $m = new MainWindow; $m -> Pod(-file => 'ColorEditor.pm'); # or use command line path/filename: # $m -> Pod(-file => $ARGV[0]); MainLoop; A miscellany of internet perl/Tk resources includes:World Wide Web - perl/Tk man pages http://pubweb.bnl.gov/~ptk/doc/index.html http://w4.lns.cornell.edu/~pvhp/ptk/doc/ http://w4.lns.cornell.edu/~pvhp/ptk/pod/The Perl/Tk Newsgroup comp.lang.perl.tkPerl Newsgroups comp.lang.perl.misc comp.lang.perl.anounce comp.lang.perl.modulesTcl Newsgroups comp.lang.tcl comp.lang.tcl.announceMiscellaneous Newsgroups comp.answers news.answersPerl/Tk FAQ-Archives (ftp sites) [Note: FAQ may be many separate files] (see also CPAN sites) ftp://rtfm.mit.edu/pub/usenet/comp.lang.perl.tk ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/comp/lang/perl/tk ftp://ftp.uu.net/usenet/news.answers/perl-faq/ptk-faq ftp://ftp.ccd.bnl.gov/pub/ptk/ 130.199.54.188 ftp://ftp.ccd.bnl.gov/pub/ptk/ptkFAQ.txt 130.199.54.188 ftp://ftp.wpi.edu/perl5/pTk-FAQ 130.215.24.209 ftp://perl.com/pub/perl/doc/ptkFAQ.gz 199.45.129.30 ftp://perl.com/pub/perl/doc/ptkFAQ.ps.gz 199.45.129.30WWW-FAQ for perl/Tk http://www.perltk.org/contrib/ptkTOC.html World Wide Web - perl/Tk info sites http://pubweb.bnl.gov/~ptk/ http://fxfx.com/kgr/compound/ (Perl Tk Compound Widget Page) http://www.perltk.org/contrib/ptkIMG.html (FAQ image supplement) http://www.perltk.org/contrib/etc/ http://www.perltk.org/contrib/misc/ http://www.perltk.org/contrib/PNMTYAK/ http://www.mirai.com/wks/The Mailing list majordomo@lists.stanford.edu ptk@lists.stanford.edu Perl Specific Documentation
There are a growing number Perl books available. A more complete Perl-bibliographic discussion than that given here is available in the Perl FAQ or at: http://www.perl.com/perl/info/books.html
For Perl 5 there is (as of September 1996) a "New Camel" by Larry Wall, Tom Christiansen, and Randal L. Schwartz, with Stephen Potter.
Programming Perl 2nd Edition
Larry Wall, Tom Christiansen, & Randal L. Schwartz with Stephen Potter
(c) 1996 O'Reilly & Associates Inc.
ISBN 1-56592-149-6 (English)
A forthcoming book from major Perl/Tk contributor Sriram Srinivasan is:
Advanced Perl Programming
By Sriram Srinivasan
1st Edition August 1997 (est.)
O'Reilly & Associates Inc.
ISBN: 1-56592-220-4, Order Number: 2204
440 pages (est.), $34.95 (est.)
A second edition of the Llama is due out soon too:
Learning Perl, 2ndEdition
Randal L. Schwartz
June 1997 (est.) O'Reilly & Associates Inc.
ISBN 1-56592-284-0 (English)
The two early Perl books by Schwartz and Wall are very helpful (even if they do pertain to perl 4 and not 5. Beware that perl/Tk makes extensive use of perl 5 object-oriented features.):
Learning Perl (The Llama)
Randal L. Schwartz
Copyright (c) 1993 O'Reilly & Associates Inc.
ISBN 1-56592-042-2 (English)
ISBN 2-84177-005-2 (French)
ISBN 3-930673-08-8 (German)
ISBN 4-89502-678-1 (Japanese)
Programming Perl (The Camel)
Larry Wall and Randal L. Schwartz
Copyright (c) 1991 O'Reilly & Associates Inc.
ISBN 0-937175-64-1 (English)
ISBN 3-446-17257-2 (German) (Programmieren in Perl, translator: Hanser Verlag)
ISBN 4-89052-384-7 (Japanese)
There is also some Perl5 (book material) information at: http://www.metronet.com/1h/perlinfo/perl5/
Jon Orwant (the organizer of the comp.lang.perl.tk newgroup) has a book on Perl 5 that has a chapter that discusses the Tk extension. (Please note that it is mostly about Perl 5, there is a some discussion of four simple Perl/Tk programs, but it is not a book wholly devoted to Perl/Tk.) It is nevertheless a good introduction to object-oriented Perl 5 programming. The relevant info:
Perl 5 Interactive Course
Jon Orwant
(c) 1996 The Waite Group Press
A Division of SAMS Publishing, Corte Madera, CA USA
ISBN: 1-57169-064-6
The Perl 5 Quick Reference Guide (may require LaTeX for installation) can be obtained from any CPAN ftp site. Detailed location information is also available at the author's website: http://www.xs4all.nl/~jvromans/perlref.html
The quick reference guide has also been turned into a small Nutshell handbook:
Perl 5 Desktop Reference
Johan Vromans
Copyright (c) February 1996 O'Reilly & Associates Inc.
ISBN: 1-56592-187-9; Order number: 1879
Eric F. Johnson has a book that discusses many perl5 for Unix vs. perl5 for Windows NT issues. He includes a final chapter with extensive discussion of the Tk extension and the ->Text() widget in particular. The information on that book is:
Cross-Platform Perl
(c) 1996 Eric F. Johnson
MIS:Press/M&T Books
ISBN: 1-55851-483-X
Kamran Husain and Robert F. Breedlove have written a perl 5 book that includes a chapter on Tk with some discussion of Menu()s. That book is:
Perl 5 Unleashed
Kamran Husain and Robert F. Breedlove
(c) 1996 Sams Publishing, Indianapolis, IN
ISBN: 0-672-30891-6
There is also a "Perl 5 How-To" book available that contains a great deal of erroneous information about perl/Tk. Among other things that book wrongly mentions that it is necessary to have a complete Tcl/Tk library installed on one's system to compile the Tk extension to perl. (They are incorrect - it is only necessary to have the appropriate perl version, libc and Xlib, the Tk extension is otherwise "self-contained").
There is also a book on perl web client. It features a a chapter on perl/Tk that was written by Nancy Walsh:
Web Client Programming with Perl
Clinton Wong
1st Edition March 1997
O'Reilly & Associates Inc.
ISBN: 1-56592-214-X; Order number: 214X
Additional book information may be found at Tom Christiansen's perl & cgi books page, or at his Perl-related Book Reviews page.
The multi-part perl 5 manual pages are available (assuming they have been installed in your MANPATH, type man perl, man perlmod etc.).
The perl 5 man pages are also available on the web at a number of locations. In general the more recent the documentation the more helpful it is.
In addition to the CPAN ftp source sites, a miscellany of internet perl resources includes: Newsgroups comp.lang.perl.misc comp.lang.perl.announce comp.lang.perl.modules comp.infosystems.www.authoring.cgi comp.answers news.answersPerl FAQ-Archives (ftp sites) [Note: FAQ may be many separate files](as of 5.004 the FAQ ships in pod format with perl) (see also the CPAN sites) North America ftp://rtfm.mit.edu/pub/usenet/news.answers/perl-faq/ ftp://ftp.uu.net/usenet/news.answers/perl-faq/ 192.48.96.9 ftp://ftp.khoros.unm.edu/pub/perl/faq.gz 198.59.155.28 Europe ftp://ftp.cs.ruu.nl/pub/NEWS.ANSWERS/perl-faq/ 131.211.80.17 ftp://src.doc.ic.ac.uk/packages/perl/FAQ 146.169.2.10Gopher Perl FAQ gopher://gopher.metronet.com/11/perlinfo/faqWWW-FAQ for Perl http://www.perl.com/perl/faq/ http://www.smartpages.com/bngfaqs/comp/lang/perl/top.html http://www.smartpages.com/bngfaqs/comp/lang/perl/misc/top.html http://www.smartpages.com/bngfaqs/comp/lang/perl/announce/top.html http://www.cis.ohio-state.edu/hypertext/faq/usenet/perl-faq/top.htmlPerl for Win32 FAQ (discusses Win95) http://www.perl.org/CPAN/doc/FAQs/win32/Perl_for_Win32_FAQ.htmlPerl info sitesGopher (gopher:70) perl info sites USA gopher://gopher.metronet.com/11h/perlinfoWorld Wide Web (http:80) perl info sites USA http://www.yahoo.com/Computers_and_Internet/Languages/Perl/index.html http://www.perl.com/ http://www.khoros.unm.edu/staff/neilb/perl/home.html http://www.khoros.unm.edu/staff/neilb/perl/metaFAQ/ http://www.metronet.com/perlinfo/ http://www.metronet.com/perlinfo/perl5.html (Perl 5) http://www.eecs.nwu.edu/perl/perl.html http://cesr39.lns.cornell.edu/public/perl/ http://www.virtualschool.edu/mon/Perl.html http://www.hermetica.com/technologia/unexec/ http://www.oac.uci.edu/indiv/ehood/perlWWW/ http://web.sau.edu/~mkruse/www/scripts/ http://orwant.www.media.mit.edu/the_perl_journal/ http://www.perl.com/Architext/AT-allperl.html http://www.mispress.com/introcgi/ http://www.walrus.com/~smithj/webcan/ http://web.syr.edu/~chsiao05/cps600_project.html http://www.iftech.com/classes/webdev/webdev_perl.htm http://www.cc.iastate.edu/perlmenu/ http://www.ora.com/www/item/cgi_prog.html http://www.netaxs.com/~joc/perlring.html UK http://pubweb.nexor.co.uk/public/perl/perl.html http://www.bio.cam.ac.uk/web/form.html Elsewhere http://www.oasis.leo.org/perl/00-index.htmlWeb references to Perl mailing lists http://www.perl.com/perl/info/mailing-lists.html http://www.nicoh.com/cgi-bin/lwgate/PERL5-PORTERS/ http://www.hut.fi/~jhi/perl5-porters.html http://www.rosat.mpe-garching.mpg.de/mailing-lists/ Tcl/Tk Specific Documentation
The two Tcl/Tk books by Ousterhout and Welch are very good starting points (you must however, translate the tcl-isms to perl in the sample scripts):
Tcl and the Tk Toolkit
John K. Ousterhout
Copyright (c) 1994 Addison-Wesley Publishing Company
ISBN 0-201-63337-X (alk. paper)
LOC QA76.73.T44097 1994; 005.13'3--dc20
Practical Programming in Tcl and Tk
Brent Welch
Copyright (c) 1995 Prentice Hall
ISBN 0-13-182007-9
Within the tclsh or wish shells your manpath includes the tcl/tk man pages (which may not be in your login MANPATH). Thus from the % prompt within either shell type commands like: % man -k Tk
The Tcl/Tk Reference Guide is also a source of useful information. Although it's Tcl specific most perl/Tk commands can be, more or less, easily derived from it. [Note that in perl/Tk the names of some functions and some configuration options have changed slightly from their Tcl/Tk counterparts. With recent versions of perl/Tk a great many functions start with an upper case letter and continue with all lower case letters (e.g. there is a perl/Tk Entry widget but no entry widget), and many configuration options are all lower case (e.g. there is a perl/Tk highlightthickness option but no highlightThickness option).] You may fetch the Tcl/Tk Reference Guide (may require LaTeX for installation) from: ftp://ftp.slac.stanford.edu/software/TkMail/tkref-4.0.1.tar.gz 134.79.18.30 ftp://ftp.aud.alcatel.com/tcl/docs/tkref-4.0.1.tar.gz 198.64.191.10
There are a number of other Tcl/Tk resources on the internet including: Newsgroups comp.lang.tcl comp.lang.tcl.announce comp.infosystems.www.authoring.cgi comp.answers news.answersFAQ-Archive (ftp) [Note: Tcl FAQ may be many files, Tk FAQ is one file] ftp://ftp.aud.alcatel.com/tcl/docs/ 198.64.191.10 ftp://rtfm.mit.edu/pub/usenet/news.answers/tcl-faq ftp://rtfm.mit.edu/pub/usenet/news.answers/tcl-faq/tkWWW-FAQ for Tcl/Tk http://www.teraform.com/~lvirden/tcl-faq/ http://www.smartpages.com/faqs/tcl-faq/top.html http://www.smartpages.com/bngfaqs/comp/lang/tcl/top.html http://www.cis.ohio-state.edu/hypertext/faq/usenet/tcl-faq/top.html http://www.cis.ohio-state.edu/hypertext/faq/bngusenet/comp/lang/tcl/top.html http://www.sco.com/Technology/tcl/Tcl.htmlWorld Wide Web - Tcl/Tk info sites Canada http://web.cs.ualberta.ca/~wade/Auto/Tcl.html UK http://http2.brunel.ac.uk:8080/~csstddm/TCL2/TCL2.html http://www.cis.rl.ac.uk/proj/TclTk/ USA http://www.yahoo.com/Computers_and_Internet/Languages/Tcl_Tk/index.html http://www.sunlabs.com/research/tcl/docs.html http://www.sunlabs.com/research/tcl/4.0.html http://www.sco.com/Technology/tcl/Tcl.html http://www.neosoft.com/tcl/ http://www.elf.org/tcltk-man-html/contents.htmlTcl/Tk - miscellaneous extensions ftp://ftp.cme.nist.gov/pub/expect/ http://www.cs.hut.fi/~kjk/porttk.html http://tix.sourceforge.net/ http://www.ece.cmu.edu/afs/ece/usr/svoboda/www/th/homepage.html http://www.tcltk.com/ http://www.neosoft.com/tcl/TclX.html http://www.eolas.com/eolas/webrouse/tcl.htm http://www.se.cuhk.hk/~hkng2/big5tk/big5tk.html http://www.cs.uoregon.edu/~jhobbs/work/ [BLT etc.] X Documentation
Tk certainly makes the generation of GUI code a lot easier than hard coding things in traditional compiled languages such as C, C++, or Lisp. Nevertheless there is a very large body of X documentation out there that will assist all widget and GUI builders with issues of design, implementation, etc. Hence it is good practice to be informed of the general design goals of X itself as well as the other toolkits that have been built on top of X.
There are a number of X resources on the internet including:
Newsgroups comp.windows.x comp.windows.x.announce comp.windows.x.appsX FAQs: ftp://ftp.x.org/contrib/faqs/X FAQ on the World Wide Web: http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-1 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-2 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-3 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-4 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-5 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-6 http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-7X Window System book info on the Web: http://www.x.org/ftp/contrib/docs/Xbibliography.OReilly http://www.ora.com/catalog/v1/ http://www.ora.com/catalog/v2/ http://www.ora.com/catalog/v3/ http://www.ora.com/catalog/v4/ http://www.ora.com/catalog/v5/ http://www.ora.com/catalog/v6a/ http://www.ora.com/catalog/v6b/ http://www.ora.com/catalog/v6c/ http://www.ora.com/catalog/r6/noframes.html http://www.ora.com/oracom/prog/flanart.htmlWorld Wide Web - X Window System info sites http://www.x.org/ http://www.x.org/consortium/GettingX.html http://www.x.org/consortium/x_info.html http://www.x.org/consortium/R6.1doc/man/X11/ http://www.wolfram.com/~cwikla/widget/ http://www.zeta.org.au/~rosko/pigui.htm http://www.rahul.net/kenton/xsites.html http://www.unx.com/DD/txaCurrent.shtml
译文:
7. 哪里有Perl/Tk的文档?
其实,Tk模块的安装包中就带有大量的Perl/Tk文档,所以,可能你的系统上已经有很多相关的文档了。
更多的文档还在计划中:有些针对Perl/Tk的书正在创作过程中(译者注:可能有些书现在已经面世了,比如:Learning Perl/Tk,Mastering Perl/Tk等等)。同时一个关于Perl/Tk的期刊也在建设中,当然,还有一个逐步丰富的“常见问题”(就是你现在看到的这个文档)。
其它你可能会想要参考的文档资料大致可以分为Perl/Tk,Perl,Tcl/Tk和X几类:
Perl/Tk 专门文档
用户手册
伴随着Tk包的不断更新,各种各样的Perl/Tk的简易老式文档都被转换系统帮助文件的格式,并在你安装Perl/Tk的过程中(make install)同时被安装到了你的系统中。如果你已经安装了较新版本的Perl/Tk,你可以试试“man 3 Tk::Tk”命令(只对Unix系统)。如果不行,你最好找一下你的系统管理员简称一下MANPATH环境变量是否设置正确。
在你的Tk安装目录中应该有一个名为doc/的子目录,在那里有很多.htm的文件(在你使用了make install之后)。这些文件都是原始的Tcl/Tk的手册页(来自man*子目录),但是这些*.htm文件已经被转换成了Perl的语法,并且使用了从超文本的格式。你可以使用Perl/Tk的网络浏览器来在当前目录中阅读它们:
tkweb index.html
或者,你也可以把它们安装到一个web服务器的目录里,然后在网络上浏览它们。还有,你还可以在下面的网址浏览这些文档:
http://w4.lns.cornell.edu/~pvhp/ptk/doc/
新闻组
Perl/Tk的新闻组的名字是comp.lang.perl.tk,这个“常见问题”文档会被定期的张贴在这个新闻组里(就像其它的一些组一样)。这个新闻组和(或)ptk的邮件列表是张贴Perl/Tk的问题的最合适的地方——即使是非常简单的!(不过,有时回答会比较慢哟……L)
nTk/pTk邮件列表
邮件列表是comp.lang.perl.tk新闻组的很好的补充。所有发到列表中的信息都会被转发到新闻组中(但不是所有新闻组中的帖子都会被转发到邮件列表中)。有些Perl/Tk的专家只能通过电子邮件和他们联系。
nTk/pTk邮件列表档案也是非常有用的资源,你可以通过下面的网址访问:
http://pubweb.bnl.gov/~ptk/
或者是通过ftp:
ftp://ftp.ccd.bnl.gov/pub/ptk/archives/
(都在美国)。你还可以在下面的网址中对另一个ptk的邮件列表的超文本档案中查找(感谢德国的Achim Bohnet写了一个CGI脚本):
http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/
要从邮件列表中受到邮件,你必须事先订阅。订阅的办法是发如下内容的电子邮件到majordomo@lists.stanford.edu:
subscribe ptk joe.user@somewhere (Joe D. User)
其中,你应该替换为自己的邮件地址和姓名。
(注:如果需要取消订阅ptk,你应该发送一个“unsubscribe ptk”的邮件到上面同样的信箱。但是,你必须用当初订阅时的帐户和电脑来完成取消订阅。特别需要注意的是,如果你是在以超文本格式看这个FAQ,因为各种浏览器的差别,你也许无法通过点击我们给出的mailto的超链接来取消订阅——如果你的浏览器关联的帐户或电脑与你订阅时的不同的话。感谢您的合作。)
演示程序
在安装完Tk以后,你可以检查并尝试运行你的Tk安装目录中的一些脚本。或者你也许会有兴趣测试一下已经安装的代码:
l perl5/site_perl/Tk/demos/或者perl5/site_perl/Tk/demos/widget_lib/目录(新版本的Tk)
l perl5/Tk/demos/或者perl5/Tk/demos/widget_lib/目录(旧版本,如Tk-b8)
要知道你的系统中安装的perl5目录的具体位置,可以在使用如下的perl命令(注意,这是在命令行提示符下使用的,不是在perl的脚本里面):
perl -e 'print join("\n",@INC,"");'
如果从上面的命令结果中没有perl5的目录,那么请用下面的命令来确定你确实已经安装,并正在使用perl5(这也是只在命令行中键入的):
perl -v
更多的pod和man文档
【前面已经提过,大量的Tcl/Tk的手册页已经由*roff格式转换成了html文档,并且就在你的Tk安装目录中的doc/子目录中。这些文档应该是Perl/Tk方面最权威和全面的参考资料。
这些Tk安装包中的pod文档就是Perl的简易老式文档的例子,这种格式是可读的(例如,你可以用more,cat或者less来查看它们,甚至直接打印)。很多(不是所有的)Perl/Tk的简易老式文档都是由*roff格式转换而来的,并且在Perl/Tk安装的过程中自动的被作为Perl的手册页装入。
如果你已经安装了新版本的Perl/Tk,你可以尝试使用如下的命令来获取Tk的帮助:
man 3 Tk::Tk (只对Unix系统可以)
如果这样不行的话,请使用下面的方法检查你系统的手册页搜索路径:
perl -MConfig -e 'print $Config{man1dir},"\n",$Config{man3dir},"\n"'
如果这样仍然不行,请向你的系统管理员咨询正确的MANPATH参数设置和所安装的Tk的版本。
原始的.pod文件(例如UserGuide.pod)可以使用tkpod超文本pod阅读器来查看,也可以先用那些各种各样的重格式化的Perl脚本处理后再阅读。这些程序包括pod2man,pod2text,pod2html,pod2latex等等(这些脚本都是跟随Perl一起安装的)。其它的格式转换程序还包括pod2texinfo,pod2fm,pod2pdf等等。如果你的系统中没有这些程序,可以到某个CPAN的站点去下载。
在命令行中可以使用类似(取决于你的系统)下面的命令:
tkpod site_perl/Tk/UserGuide.pod
或者,如果你喜欢Unix手册的风格:
pod2man perl5/Tk/UserGuide.pod | nroff –man | more
(注意,这里我们使用的是完整的路径,还有一种方法是先cd到文件所在的目录中,然后使用:
pod2man UserGuide.pod | nroff –man | more
另外,还有一个Perl的脚本可以直接帮你执行上面的命令,如下:
perldoc UserGuide
注意如果一个Perl的模块中包含了pod格式的文档说明,你也可以直接对它使用tkpod(或者perldoc),例如:
tkpod ColorEditor.pm
(请注意,不幸的是,并非所有的.pm模块文件都内嵌有pod文档说明。)
如果你找不到系统中的tkpod程序,而你又希望能有图形用户界面的阅读工具,可以使用下面的脚本(请先做适当的修改):
#!/usr/bin/perl
use Tk;
use Tk::Pod;
my $m = new MainWindow;
$m -> Pod(-file => 'ColorEditor.pm');
# or use command line path/filename:
# $m -> Pod(-file => $ARGV[0]);
MainLoop;
互联网上的Perl/Tk资源
互联网上的Perl/Tk手册页
http://pubweb.bnl.gov/~ptk/doc/index.html
http://w4.lns.cornell.edu/~pvhp/ptk/doc/
http://w4.lns.cornell.edu/~pvhp/ptk/pod/
Perl/Tk新闻组
comp.lang.perl.tk
Perl新闻组
comp.lang.perl.misc
comp.lang.perl.anounce
comp.lang.perl.modules
Tcl新闻组
comp.lang.tcl
comp.lang.tcl.announce
其它混杂的新闻组
comp.answers
news.answers
Perl/Tk常见问题档案(ftp站点) [注意: FAQ可能是很多文件]
ftp://rtfm.mit.edu/pub/usenet/comp.lang.perl.tk
ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/comp/lang/perl/tk
ftp://ftp.uu.net/usenet/news.answers/perl-faq/ptk-faq
ftp://ftp.ccd.bnl.gov/pub/ptk/ 130.199.54.188
ftp://ftp.ccd.bnl.gov/pub/ptk/ptkFAQ.txt 130.199.54.188
ftp://ftp.wpi.edu/perl5/pTk-FAQ 130.215.24.209
ftp://perl.com/pub/perl/doc/ptkFAQ.gz 199.45.129.30
ftp://perl.com/pub/perl/doc/ptkFAQ.ps.gz 199.45.129.30
互联网上的perl/Tk常见问题
http://www.perltk.org/contrib/ptkTOC.html perl/Tk信息站点
http://pubweb.bnl.gov/~ptk/
http://fxfx.com/kgr/compound/ (Perl/Tk组合组件主页)
http://www.perltk.org/contrib/ptkIMG.html (常见问题的图形补充)
http://www.perltk.org/contrib/etc/ http://www.perltk.org/contrib/misc/ http://www.perltk.org/contrib/PNMTYAK/ http://www.mirai.com/wks/
邮件列表
majordomo@lists.stanford.edu
ptk@lists.stanford.edu
(译者:下面的内容都不是针对Perl/Tk的了,而且大部分是一些链接,所以就略去了——实在太多了……大家自己点进去看吧!)
(注:因为此原始网页上copy下来的内容格式在这里总是不对,所以为了方便大家阅读,我把后面的内容调整后贴在了下面)
Perl Specific Documentation
There are a growing number Perl books available. A more complete Perl-bibliographic discussion than that given here is available in the Perl FAQ or at: http://www.perl.com/perl/info/books.html
For Perl 5 there is (as of September 1996) a "New Camel" by Larry Wall, Tom Christiansen, and Randal L. Schwartz, with Stephen Potter.
Programming Perl 2nd Edition
Larry Wall, Tom Christiansen, & Randal L. Schwartz with Stephen Potter
(c) 1996 O'Reilly & Associates Inc.
ISBN 1-56592-149-6 (English)
A forthcoming book from major Perl/Tk contributor Sriram Srinivasan is:
Advanced Perl Programming
By Sriram Srinivasan
1st Edition August 1997 (est.)
O'Reilly & Associates Inc.
ISBN: 1-56592-220-4, Order Number: 2204
440 pages (est.), $34.95 (est.)
A second edition of the Llama is due out soon too:
Learning Perl, 2ndEdition
Randal L. Schwartz
June 1997 (est.) O'Reilly & Associates Inc.
ISBN 1-56592-284-0 (English)
The two early Perl books by Schwartz and Wall are very helpful (even if they do pertain to perl 4 and not 5. Beware that perl/Tk makes extensive use of perl 5 object-oriented features.):
Learning Perl (The Llama)
Randal L. Schwartz
Copyright (c) 1993 O'Reilly & Associates Inc.
ISBN 1-56592-042-2 (English)
ISBN 2-84177-005-2 (French)
ISBN 3-930673-08-8 (German)
ISBN 4-89502-678-1 (Japanese)
Programming Perl (The Camel)
Larry Wall and Randal L. Schwartz
Copyright (c) 1991 O'Reilly & Associates Inc.
ISBN 0-937175-64-1 (English)
ISBN 3-446-17257-2 (German) (Programmieren in Perl, translator: Hanser Verlag)
ISBN 4-89052-384-7 (Japanese)
There is also some Perl5 (book material) information at: http://www.metronet.com/1h/perlinfo/perl5/
Jon Orwant (the organizer of the comp.lang.perl.tk newgroup) has a book on Perl 5 that has a chapter that discusses the Tk extension. (Please note that it is mostly about Perl 5, there is a some discussion of four simple Perl/Tk programs, but it is not a book wholly devoted to Perl/Tk.) It is nevertheless a good introduction to object-oriented Perl 5 programming. The relevant info:
Perl 5 Interactive Course
Jon Orwant
(c) 1996 The Waite Group Press
A Division of SAMS Publishing, Corte Madera, CA USA
ISBN: 1-57169-064-6
The Perl 5 Quick Reference Guide (may require LaTeX for installation) can be obtained from any CPAN ftp site. Detailed location information is also available at the author's website: http://www.xs4all.nl/~jvromans/perlref.html
The quick reference guide has also been turned into a small Nutshell handbook:
Perl 5 Desktop Reference
Johan Vromans
Copyright (c) February 1996 O'Reilly & Associates Inc.
ISBN: 1-56592-187-9; Order number: 1879
Eric F. Johnson has a book that discusses many perl5 for Unix vs. perl5 for Windows NT issues. He includes a final chapter with extensive discussion of the Tk extension and the ->Text() widget in particular. The information on that book is:
Cross-Platform Perl
(c) 1996 Eric F. Johnson
MIS:Press/M&T Books
ISBN: 1-55851-483-X
Kamran Husain and Robert F. Breedlove have written a perl 5 book that includes a chapter on Tk with some discussion of Menu()s. That book is:
Perl 5 Unleashed
Kamran Husain and Robert F. Breedlove
(c) 1996 Sams Publishing, Indianapolis, IN
ISBN: 0-672-30891-6
There is also a "Perl 5 How-To" book available that contains a great deal of erroneous information about perl/Tk. Among other things that book wrongly mentions that it is necessary to have a complete Tcl/Tk library installed on one's system to compile the Tk extension to perl. (They are incorrect - it is only necessary to have the appropriate perl version, libc and Xlib, the Tk extension is otherwise "self-contained").
There is also a book on perl web client. It features a a chapter on perl/Tk that was written by Nancy Walsh:
Web Client Programming with Perl
Clinton Wong
1st Edition March 1997
O'Reilly & Associates Inc.
ISBN: 1-56592-214-X; Order number: 214X
Additional book information may be found at Tom Christiansen's perl & cgi books page, or at his Perl-related Book Reviews page.
The multi-part perl 5 manual pages are available (assuming they have been installed in your MANPATH, type man perl, man perlmod etc.).
The perl 5 man pages are also available on the web at a number of locations. In general the more recent the documentation the more helpful it is.
In addition to the CPAN ftp source sites, a miscellany of internet perl resources includes:
Newsgroups
comp.lang.perl.misc
comp.lang.perl.announce
comp.lang.perl.modules
comp.infosystems.www.authoring.cgi
comp.answers
news.answers
Perl FAQ-Archives (ftp sites) [Note: FAQ may be many separate files]
(as of 5.004 the FAQ ships in pod format with perl)
(see also the CPAN sites)
North America
ftp://rtfm.mit.edu/pub/usenet/news.answers/perl-faq/
ftp://ftp.uu.net/usenet/news.answers/perl-faq/ 192.48.96.9
ftp://ftp.khoros.unm.edu/pub/perl/faq.gz 198.59.155.28
Europe
ftp://ftp.cs.ruu.nl/pub/NEWS.ANSWERS/perl-faq/ 131.211.80.17
ftp://src.doc.ic.ac.uk/packages/perl/FAQ 146.169.2.10
Gopher Perl FAQ
gopher://gopher.metronet.com/11/perlinfo/faq
WWW-FAQ for Perl
http://www.perl.com/perl/faq/
http://www.smartpages.com/bngfaqs/comp/lang/perl/top.html
http://www.smartpages.com/bngfaqs/comp/lang/perl/misc/top.html
http://www.smartpages.com/bngfaqs/comp/lang/perl/announce/top.html
http://www.cis.ohio-state.edu/hypertext/faq/usenet/perl-faq/top.html
Perl for Win32 FAQ (discusses Win95) http://www.perl.org/CPAN/doc/FAQs/win32/Perl_for_Win32_FAQ.html
Perl info sites
Gopher (gopher:70) perl info sites
USA
gopher://gopher.metronet.com/11h/perlinfo
World Wide Web (http:80) perl info sites
USA
http://www.yahoo.com/Computers_and_Internet/Languages/Perl/index.html
http://www.perl.com/
http://www.khoros.unm.edu/staff/neilb/perl/home.html
http://www.khoros.unm.edu/staff/neilb/perl/metaFAQ/ http://www.metronet.com/perlinfo/
http://www.metronet.com/perlinfo/perl5.html (Perl 5)
http://www.eecs.nwu.edu/perl/perl.html
http://cesr39.lns.cornell.edu/public/perl/
http://www.virtualschool.edu/mon/Perl.html
http://www.hermetica.com/technologia/unexec/
http://www.oac.uci.edu/indiv/ehood/perlWWW/
http://web.sau.edu/~mkruse/www/scripts/
http://orwant.www.media.mit.edu/the_perl_journal/
http://www.perl.com/Architext/AT-allperl.html
http://www.mispress.com/introcgi/
http://www.walrus.com/~smithj/webcan/
http://web.syr.edu/~chsiao05/cps600_project.html
http://www.iftech.com/classes/webdev/webdev_perl.htm
http://www.cc.iastate.edu/perlmenu/
http://www.ora.com/www/item/cgi_prog.html
http://www.netaxs.com/~joc/perlring.html
UK
http://pubweb.nexor.co.uk/public/perl/perl.html
http://www.bio.cam.ac.uk/web/form.html
Elsewhere
http://www.oasis.leo.org/perl/00-index.html
Web references to Perl mailing lists
http://www.perl.com/perl/info/mailing-lists.html
http://www.nicoh.com/cgi-bin/lwgate/PERL5-PORTERS/
http://www.hut.fi/~jhi/perl5-porters.html
http://www.rosat.mpe-garching.mpg.de/mailing-lists/
Tcl/Tk Specific Documentation
The two Tcl/Tk books by Ousterhout and Welch are very good starting points (you must however, translate the tcl-isms to perl in the sample scripts):
Tcl and the Tk Toolkit
John K. Ousterhout
Copyright (c) 1994 Addison-Wesley Publishing Company
ISBN 0-201-63337-X (alk. paper)
LOC QA76.73.T44097 1994; 005.13'3--dc20
Practical Programming in Tcl and Tk
Brent Welch
Copyright (c) 1995 Prentice Hall
ISBN 0-13-182007-9
Within the tclsh or wish shells your manpath includes the tcl/tk man pages (which may not be in your login MANPATH). Thus from the % prompt within either shell type commands like:
% man -k Tk
The Tcl/Tk Reference Guide is also a source of useful information. Although it's Tcl specific most perl/Tk commands can be, more or less, easily derived from it. [Note that in perl/Tk the names of some functions and some configuration options have changed slightly from their Tcl/Tk counterparts. With recent versions of perl/Tk a great many functions start with an upper case letter and continue with all lower case letters (e.g. there is a perl/Tk Entry widget but no entry widget), and many configuration options are all lower case (e.g. there is a perl/Tk highlightthickness option but no highlightThickness option).] You may fetch the Tcl/Tk Reference Guide (may require LaTeX for installation) from:
ftp://ftp.slac.stanford.edu/software/TkMail/tkref-4.0.1.tar.gz 134.79.18.30
ftp://ftp.aud.alcatel.com/tcl/docs/tkref-4.0.1.tar.gz 198.64.191.10
There are a number of other Tcl/Tk resources on the internet including:
Newsgroups
comp.lang.tcl
comp.lang.tcl.announce
comp.infosystems.www.authoring.cgi
comp.answers
news.answers
FAQ-Archive (ftp) [Note: Tcl FAQ may be many files, Tk FAQ is one file]
ftp://ftp.aud.alcatel.com/tcl/docs/ 198.64.191.10
ftp://rtfm.mit.edu/pub/usenet/news.answers/tcl-faq
ftp://rtfm.mit.edu/pub/usenet/news.answers/tcl-faq/tk
WWW-FAQ for Tcl/Tk
http://www.teraform.com/~lvirden/tcl-faq/ http://www.smartpages.com/faqs/tcl-faq/top.html
http://www.smartpages.com/bngfaqs/comp/lang/tcl/top.html
http://www.cis.ohio-state.edu/hypertext/faq/usenet/tcl-faq/top.html
http://www.cis.ohio-state.edu/hypertext/faq/bngusenet/comp/lang/tcl/top.html
http://www.sco.com/Technology/tcl/Tcl.html
World Wide Web - Tcl/Tk info sites
Canada
http://web.cs.ualberta.ca/~wade/Auto/Tcl.html
UK
http://http2.brunel.ac.uk:8080/~csstddm/TCL2/TCL2.html
http://www.cis.rl.ac.uk/proj/TclTk/
USA
http://www.yahoo.com/Computers_and_Internet/Languages/Tcl_Tk/index.html
http://www.sunlabs.com/research/tcl/docs.html
http://www.sunlabs.com/research/tcl/4.0.html
http://www.sco.com/Technology/tcl/Tcl.html
http://www.neosoft.com/tcl/
http://www.elf.org/tcltk-man-html/contents.html
Tcl/Tk - miscellaneous extensions
ftp://ftp.cme.nist.gov/pub/expect/
http://www.cs.hut.fi/~kjk/porttk.html
http://tix.sourceforge.net/ http://www.ece.cmu.edu/afs/ece/usr/svoboda/www/th/homepage.html
http://www.tcltk.com/ http://www.neosoft.com/tcl/TclX.html
http://www.eolas.com/eolas/webrouse/tcl.htm http://www.se.cuhk.hk/~hkng2/big5tk/big5tk.html
http://www.cs.uoregon.edu/~jhobbs/work/ [BLT etc.]
X Documentation
Tk certainly makes the generation of GUI code a lot easier than hard coding things in traditional compiled languages such as C, C++, or Lisp. Nevertheless there is a very large body of X documentation out there that will assist all widget and GUI builders with issues of design, implementation, etc. Hence it is good practice to be informed of the general design goals of X itself as well as the other toolkits that have been built on top of X.
There are a number of X resources on the internet including:
Newsgroups
comp.windows.x
comp.windows.x.announce
comp.windows.x.apps
X FAQs:
ftp://ftp.x.org/contrib/faqs/
X FAQ on the World Wide Web:
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-1
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-2
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-3
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-4
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-5
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-6
http://www.x.org/ftp/contrib/faqs/x-faq-multipart/x-faq-7
X Window System book info on the Web:
http://www.x.org/ftp/contrib/docs/Xbibliography.OReilly
http://www.ora.com/catalog/v1/
http://www.ora.com/catalog/v2/
http://www.ora.com/catalog/v3/
http://www.ora.com/catalog/v4/
http://www.ora.com/catalog/v5/
http://www.ora.com/catalog/v6a/
http://www.ora.com/catalog/v6b/
http://www.ora.com/catalog/v6c/
http://www.ora.com/catalog/r6/noframes.html
http://www.ora.com/oracom/prog/flanart.html
World Wide Web - X Window System info sites
http://www.x.org/
http://www.x.org/consortium/GettingX.html
http://www.x.org/consortium/x_info.html
http://www.x.org/consortium/R6.1doc/man/X11/
http://www.wolfram.com/~cwikla/widget/
http://www.zeta.org.au/~rosko/pigui.htm
http://www.rahul.net/kenton/xsites.html
http://www.unx.com/DD/txaCurrent.shtml