原文:
15. How do I write new modules?
You might want to start by poking around your perl/Tk build directory. Is there something there that already does what you want? Is there something that is reasonably close - but only requires minor modification?
Next go through the various perl documents - including the FAQ as well as the various relevant man pages: perlmod(1), perlobj(1), perlbot(1), (and please don't forget: perlpod(1)!)
Post your idea to comp.lang.perl.tk and discuss it with others - there might very well be someone working on an approach already. A clear explanation of all the stuff that gets put into a module was posted to the mailing list and can be found in the archive at: http://sun20.ccd.bnl.gov/~ptk/archive/ptk.1995.10/0012.html
Also, be sure to check out a recent version of the official Module List that Tim Bunce mailto:Tim.Bunce@ig.co.uk and Andreas Koenig mailto:a.koenig@franz.ww.TU-Berlin.DE maintain and post to comp.lang.perl.announce periodically. The list is also available at any CPAN ftp site as well as: http://www.perl.com/CPAN/modules/00modlist.long.html ftp://rtfm.mit.edu/pub/usenet/news.answers/perl-faq/module-list ftp://ftp.demon.co.uk/pub/perl/db/mod/module-list.txt ftp://ftp.wpi.edu/perl5/Modules/module_list.txt
Finally ready to ship? Small (perl/Tk) modules have been posted directly to comp.lang.perl.tk. Big modules may require ftp distribution (see upload info at one of the CPAN sites) then make your announcement to comp.lang.perl.tk and possibly to comp.lang.perl.announce.
译文:
15. 如何自己写新模块?
你也许会想要自己扩展Perl/Tk的安装目录,但是会不会已经有了某些(脚本或模块)本来就可以实现你所希望的功能,或者很接近你的需求,只需要很小的改动而已呢?
所以,你应该先浏览一下Perl的文档,包括perlFAQ,以及各种相关的手册页:perlmod,perlobj,perlbot和perlpod。
然后,你可以把你的想法贴到comp.lang.perl.tk新闻组里,和其它人一起讨论一下,而且也许碰巧已经有某个人正在做类似的工作了。在邮件列表中有一个清楚的列表和解释,指出了所有曾经制作模块的情况,这可以在下面的网页中看到:
http://sun20.ccd.bnl.gov/~ptk/archive/ptk.1995.10/0012.html
当然,也不要忘了去检查一下最近的官方模块列表,它们是由Tim Bunce和Andreas Koenig负责维护,并定期的贴在comp.lang.perl.announce新闻组里。当然,这个列表也可以在各个CPAN的FTP站点上找到:
http://www.perl.com/CPAN/modules/00modlist.long.html
ftp://rtfm.mit.edu/pub/usenet/news.answers/perl-faq/module-list
ftp://ftp.demon.co.uk/pub/perl/db/mod/module-list.txt
ftp://ftp.wpi.edu/perl5/Modules/module_list.txt
最后,你是否真的要开始做了呢?其实有些小的Perl/Tk模块已经被直接贴在了comp.lang.perl.tk新闻组里了,而一些较大的模块可能需要使用FTP方式发布(请参阅CPAN站点上的上传要求)。然后,你还可以在comp.lang.perl.tk或也许是comp.lang.perl.announce新闻组中宣布一下。