Scroll to navigation

PERLFAQ2(7) Perl Programmers Reference Guide PERLFAQ2(7)

NAME

perlfaq2 - 獲取和學習 Perl (2003/10/16 04:57:38)

DESCRIPTION 描述

從哪裡尋找 Perl 的源程式和文件,支援以及相關事項

哪些平臺上有 Perl?要到哪裡去找?

Perl的標準發行版(由 perl發展小組負責維護)僅以原始碼形式發行。您可在 http://www.perl.com/CPAN/src/latest.tar.gz處取得。這個檔案的格式是 POSIX tar檔案櫃,再以 gzip格式壓縮。

Perl 可以在難以記數的平臺上執行。幾乎所有已知的 Unix 衍生版本都被支援 (Perl 的本地平臺),還有其他作業系統平臺,類似 VMS, DOS, OS/2, Windows, QNX, BeOS, OS X, MPE/iX 和 Amiga.

為專有平臺準備的二進位制發行版,包括 Apple,可以從 http://www.cpan.org/ports/ 找到。因為它們不是標準發行的一部分,它們可能(事實上的確)和基本的 Perl有多方面的不同。要確切知道到底哪些地方不同,您得自行查閱它們各自的發行說明。這些差異可能是正面的(譬如它們可能附有一些原始碼發行的 perl所沒有的延伸,提供專屬某一平臺的特殊功能),亦或負面的(例如它們可能是植基於比較老舊的 Perl原始碼發行 版)。

要如何取得以二進位制形式發行的 Perl?

不管為什麼您的作業系統業者沒有將 C編譯器附在所賣的作業系統中,最好的方法是到網路上去抓一份 gcc的執行檔,然後用它來編譯 perl 。 CPAN 上所放的 gcc執行檔僅專門提供幾個特別難拿到免費編譯器的平臺,而不是給任何 Unix系 統的。

一些 URLs 可能有用:

    http://www.cpan.org/ports/
    http://www.perl.com/pub/language/info/software.html

Someone looking for a Perl for Win16 might look to Laszlo Molnar's djgpp port in http://www.cpan.org/ports/#msdos , which comes with clear installation instructions. A simple installation guide for MS-DOS using Ilya Zakharevich's OS/2 port is available at http://www.cs.ruu.nl/%7Epiet/perl5dos.html and similarly for Windows 3.1 at http://www.cs.ruu.nl/%7Epiet/perlwin3.html .

我的系統裡沒有 C編譯器。要如何編譯 perl?

因為您沒有 C 編譯器,您是沒指望了,而您的經銷商則該拿去當作祭拜 Sun god 的供品。不過說這些風涼話無濟於事。

您首先需要做的是替您的系統找一個 gcc的執行檔。參閱和您的作業系統相關的 各 Usenet FAQs,看到哪裡可以找到這種作業系統的 gcc執行檔 。

我直接將 Perl的執行檔從一臺機器上覆制到另一臺機器上,但是程式跑不起來。

那大概是您忘了複製程式庫,或者是程式庫的路徑不同的關係。您真的應該在那臺要安裝 perl的機器上將整套發行從頭編譯,然後打 make install來安裝。其他的方法大多註定要失敗。

有一個簡單的方法可用來檢查和確定東西有沒有裝對地方 --把編入 perl的 @INC陣列(perl用它來尋找程式庫的路徑)印出:

    % perl -le 'print for @INC'

如果這個指令列出了任何在您系統上不存在的路徑,那麼您或許得將適當的程式庫移到這些地方,或者製做適當的 symlinks、aliases 或捷徑。@INC 也作為命令

    % perl -V

的輸出。你也許會想看看 "How do I keep my own module/library directory?" in perlfaq8.

我抓回了原始碼,試著編譯 perl,但是 gdbm/dynamic loading/malloc/linking/...部分失敗。要如何將它搞定?

細讀 INSTALL這個檔案,這是原始碼發行版裡面的一個檔案。有時候自動設定程式 (Configure) 對某些較不尋常的系統、平臺特質、或變異會不知所措。該檔案對該如何處這類的問題,大都有詳細的說明。

Perl有哪些模組和延伸? CPAN是什麼? CPAN/src/...又代表什麼?

CPAN代表的是「大 Perl檔案庫網路」(Comprehensive Perl Archive Network),一個在全世界近200臺機器之間相互對映的巨大檔案庫。CPAN包含了原始碼、對各非原生系統的移植、使用說明、程式,以及許多由第叄類團體所寫的模組和延伸,從各商業品牌的資料庫介面、到鍵盤/螢幕控制,乃至全球資訊網漫遊及 CGI程式皆一應具全。CPAN的總主機是http://www.cpan.org/ ,但您也可以透過這個位址: http://www.cpan.org/CPAN.html 來自動連線一個在地理位置上最接近您的站。至於這個設計的運作原理,請看 http://www.perl.com/CPAN(最後頭沒有斜線)的說明。同時,http://mirror.cpan.org/ 也提供了 http://www.cpan.org/MIRRORED 的方便的介面

參見 CPAN FAQ 位於 http://www.cpan.org/misc/cpan-faq.html 來獲得有關 CPAN 的 FAQ,包括如何成為一個映象站

CPAN/path/... 是 CPAN站臺上頭的檔案的命名規範。CPAN 代表一個 CPAN對映的基準目錄,然後其餘的路徑是由該目錄到一個檔案的路徑。例如,如果您使用 ftp://ftp.funet.fi/pub/languages/perl/CPAN 來做您的 CPAN 站,那麼 CPAN/misc/japh這個檔案便可以從 ftp://ftp.funet.fi/pub/languages/perl/CPAN/misc/japh 下載到

由於目前 CPAN檔案庫中已經有近兩千個模組,因此幾乎任何您所能想到的用途,大概都已經有現成的模組可以辦到。目前在 CPAN/modules/by-category/ 底下的類 別包括了 perl核心模組、協助發展模組、作業系統介面、網路、周邊裝置、不同 processes間之溝通、資料型態工具、資料庫介面、使用者介面、與其他語言介面、檔名、檔案系統、檔案鎖定、軟體國際化及地方化、全球資訊網支援、伺服軟體工具、檔案庫和檔案壓縮、圖形變換處理、電子郵件及新聞討論群、程式流程控制工具、filehandles和輸入/輸出、微軟視窗模組,以及雜項模組 等。

參見 http://www.cpan.org/modules/00modlist.long.htmlhttp://search.cpan.org/ 來閱讀分類的模組完整列表。

CPAN 不是 O'Reilly and Associates 的附屬品.

是不是有一個經 ISO【國際標準局】或 ANSI【美國國家標準局】認可的 Perl版本?

當然沒有。Larry認為他得先被認可後然後才會輪到 Perl 。

Perl的相關資料要上哪兒找?

perl的發行版中都附有完整的使用說明中。如果 perl已安裝在您的機器上,那麼使用說明應該也已經裝在上頭了:如果您用的是一個像 Unix的系統,您可以打 man perl。這同時會帶領您到其他重要的使用說明頁。如果您用的不是 Unix 式的系統,那麼查閱使用說明的方法會有所不同;譬如說,使用說明可能會以HTML 格式來存放。不管怎麼樣,只要 perl正確地安裝,查閱使用說明應該不成問題。

如果您的系統沒有 man這個指令,或者是該指令安裝不當,那麼您可以試試 perldoc perl。如果還不成,您可以在 /usr/local/lib/perl5/pod這個目錄 下找使用說明。

如果以上的方法全失敗,那麼您可求助於 http://perldoc.cpan.org/http://www.perldoc.com/ 都提供了完整的 html 格式的幫助

面上有許多本和 Perl有關的好書,詳情請見下面一節的介紹。

Tutorial documents are included in current or upcoming Perl releases include perltoot for objects or perlboot for a beginner's approach to objects, perlopentut for file opening semantics, perlreftut for managing references, perlretut for regular expressions, perlthrtut for threads, perldebtut for debugging, and perlxstut for linking C and Perl together. There may be more by the time you read this. The following URLs might also be of assistance:

    http://perldoc.cpan.org/
    http://www.perldoc.com/
    http://bookmarks.cpan.org/search.cgi?cat=Training%2FTutorials

USENET上有哪些專門討論 Perl的新聞討論群?問題該投到哪裡?

Usenet 中有多個新聞組與 Perl 語言相關:

    comp.lang.perl.announce             Moderated announcement group
    comp.lang.perl.misc                 High traffic general Perl discussion
    comp.lang.perl.moderated        Moderated discussion group
    comp.lang.perl.modules              Use and development of Perl modules
    comp.lang.perl.tk                   Using Tk (and X) from Perl

    comp.infosystems.www.authoring.cgi  Writing CGI scripts for the Web.

Some years ago, comp.lang.perl was divided into those groups, and comp.lang.perl itself officially removed. While that group may still be found on some news servers, it is unwise to use it, because postings there will not appear on news servers which honour the official list of group names. Use comp.lang.perl.misc for topics which do not have a more-appropriate specific group.

There is also a Usenet gateway to Perl mailing lists sponsored by perl.org at nntp://nntp.perl.org , a web interface to the same lists at http://nntp.perl.org/group/ and these lists are also available under the "perl.*" hierarchy at http://groups.google.com . Other groups are listed at http://lists.perl.org/ ( also known as http://lists.cpan.org/ ).

A nice place to ask questions is the PerlMonks site, http://www.perlmonks.org/ , or the Perl Beginners mailing list http://lists.perl.org/showlist.cgi?name=beginners .

Note that none of the above are supposed to write your code for you: asking questions about particular problems or general advice is fine, but asking someone to write your code for free is not very cool.

如果我想投程式原始碼,該投到哪個板子上?

您應看程式的性質來決定該丟到哪個板子上,但也歡迎您交叉投遞一份到 comp.lang.perl.misc上頭去。如果您打算交叉投遞到 alt.sources 的話,請務必遵照該板所規定的標準,包括標頭的 Followup-To 欄不可將 alt.sources 列入; 詳見該板的 FAQ 。

If you're just looking for software, first use Google ( http://www.google.com ), Google's usenet search interface ( http://groups.google.com ), and CPAN Search ( http://search.cpan.org ). This is faster and more productive than just posting a request.

Perl 書籍

市面上有許多有關 Perl 和/或 CGI程式設計的書。其中有些很好,有些還過得去,但也有不少根本不值得買。大部分的 Perl書都列在 Tom Christiansen 所維護的列表中,其中一些有詳細的評論,位於 http://www.perl.com/perl/critiques/index.html .

毫無爭議地,最權威的 Perl參考書要數以下這本,由 Perl的創始者著作,現在是第三版 (July 2000):

    Programming Perl (the "Camel Book"):
        by Larry Wall, Tom Christiansen, and Jon Orwant
        0-596-00027-8  [3rd edition July 2000]
        http://www.oreilly.com/catalog/pperl3/
    (English, translations to several languages are also available)

The companion volume to the Camel containing thousands of real-world examples, mini-tutorials, and complete programs is:

    The Perl Cookbook (the "Ram Book"):
        by Tom Christiansen and Nathan Torkington,
            with Foreword by Larry Wall
        ISBN 1-56592-243-3 [1st Edition August 1998]
        http://perl.oreilly.com/catalog/cookbook/

If you're already a seasoned programmer, then the Camel Book might suffice for you to learn Perl from. If you're not, check out the Llama book:

    Learning Perl (the "Llama Book")
        by Randal L. Schwartz and Tom Phoenix
        ISBN 0-596-00132-0 [3rd edition July 2001]
        http://www.oreilly.com/catalog/lperl3/

And for more advanced information on writing larger programs, presented in the same style as the Llama book, continue your education with the Alpaca book:

    Learning Perl Objects, References, and Modules (the "Alpaca Book")
       by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway)
       ISBN 0-596-00478-8 [1st edition June 2003]
       http://www.oreilly.com/catalog/lrnperlorm/

If you're not an accidental programmer, but a more serious and possibly even degreed computer scientist who doesn't need as much hand-holding as we try to provide in the Llama, please check out the delightful book

    Perl: The Programmer's Companion
        by Nigel Chapman
        ISBN 0-471-97563-X [1997, 3rd printing Spring 1998]
        http://www.wiley.com/compbooks/catalog/97563-X.htm
        http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc)

If you are more at home in Windows the following is available (though unfortunately rather dated).

    Learning Perl on Win32 Systems (the "Gecko Book")
        by Randal L. Schwartz, Erik Olson, and Tom Christiansen,
            with foreword by Larry Wall
        ISBN 1-56592-324-3 [1st edition August 1997]
        http://www.oreilly.com/catalog/lperlwin/

Addison-Wesley ( http://www.awlonline.com/ ) and Manning ( http://www.manning.com/ ) are also publishers of some fine Perl books such as Object Oriented Programming with Perl by Damian Conway and Network Programming with Perl by Lincoln Stein.

An excellent technical book discounter is Bookpool at http://www.bookpool.com/ where a 30% discount or more is not unusual.

What follows is a list of the books that the FAQ authors found personally useful. Your mileage may (but, we hope, probably won't) vary.

Recommended books on (or mostly on) Perl follow.

    Programming Perl
        by Larry Wall, Tom Christiansen, and Jon Orwant
        ISBN 0-596-00027-8 [3rd edition July 2000]
        http://www.oreilly.com/catalog/pperl3/
    

    Perl 5 Pocket Reference
    by Johan Vromans
        ISBN 0-596-00032-4 [3rd edition May 2000]
        http://www.oreilly.com/catalog/perlpr3/
    

    Perl in a Nutshell
    by Ellen Siever, Stephan Spainhour, and Nathan Patwardhan
        ISBN 1-56592-286-7 [1st edition December 1998]
        http://www.oreilly.com/catalog/perlnut/
    
    Elements of Programming with Perl
        by Andrew L. Johnson
        ISBN 1-884777-80-5 [1st edition October 1999]
        http://www.manning.com/Johnson/
    

    Learning Perl
        by Randal L. Schwartz and Tom Phoenix
        ISBN 0-596-00132-0 [3rd edition July 2001]
        http://www.oreilly.com/catalog/lperl3/
    

    Learning Perl Objects, References, and Modules
       by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway)
       ISBN 0-596-00478-8 [1st edition June 2003]
       http://www.oreilly.com/catalog/lrnperlorm/
    

    Learning Perl on Win32 Systems
        by Randal L. Schwartz, Erik Olson, and Tom Christiansen,
            with foreword by Larry Wall
        ISBN 1-56592-324-3 [1st edition August 1997]
        http://www.oreilly.com/catalog/lperlwin/
    

    Perl: The Programmer's Companion
        by Nigel Chapman
        ISBN 0-471-97563-X [1997, 3rd printing Spring 1998]
    http://www.wiley.com/compbooks/catalog/97563-X.htm
    http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc)
    

    Cross-Platform Perl
        by Eric Foster-Johnson
        ISBN 1-55851-483-X [2nd edition September 2000]
        http://www.pconline.com/~erc/perlbook.htm
    

    MacPerl: Power and Ease
        by Vicki Brown and Chris Nandor,
            with foreword by Matthias Neeracher
        ISBN 1-881957-32-2 [1st edition May 1998]
        http://www.macperl.com/ptf_book/
    
    The Perl Cookbook
        by Tom Christiansen and Nathan Torkington
            with foreword by Larry Wall
        ISBN 1-56592-243-3 [1st edition August 1998]
        http://www.oreilly.com/catalog/cookbook/
    

    Effective Perl Programming
        by Joseph Hall
        ISBN 0-201-41975-0 [1st edition 1998]
        http://www.awl.com/
    
    Mastering Regular Expressions
        by Jeffrey E. F. Friedl
        ISBN 0-596-00289-0 [2nd edition July 2002]
        http://www.oreilly.com/catalog/regex2/
    

    Network Programming with Perl
        by Lincoln Stein
        ISBN 0-201-61571-1 [1st edition 2001]
        http://www.awlonline.com/
    

    Object Oriented Perl
        Damian Conway
            with foreword by Randal L. Schwartz
        ISBN 1-884777-79-1 [1st edition August 1999]
        http://www.manning.com/Conway/
    

    Data Munging with Perl
        Dave Cross
        ISBN 1-930110-00-6 [1st edition 2001]
        http://www.manning.com/cross
    

    Mastering Perl/Tk
        by Steve Lidie and Nancy Walsh
        ISBN 1-56592-716-8 [1st edition January 2002]
        http://www.oreilly.com/catalog/mastperltk/
    

    Extending and Embedding Perl
       by Tim Jenness and Simon Cozens
       ISBN 1-930110-82-0 [1st edition August 2002]
       http://www.manning.com/jenness
    

和 Perl 有關的雜誌

The first (and for a long time, only) periodical devoted to All Things Perl, The Perl Journal contains tutorials, demonstrations, case studies, announcements, contests, and much more. TPJ has columns on web development, databases, Win32 Perl, graphical programming, regular expressions, and networking, and sponsors the Obfuscated Perl Contest and the Perl Poetry Contests. Beginning in November 2002, TPJ moved to a reader-supported monthly e-zine format in which subscribers can download issues as PDF documents. For more details on TPJ, see http://www.tpj.com/

Beyond this, magazines that frequently carry quality articles on Perl are The Perl Review ( http://www.theperlreview.com ), Unix Review ( http://www.unixreview.com/ ), Linux Magazine ( http://www.linuxmagazine.com/ ), and Usenix's newsletter/magazine to its members, login: ( http://www.usenix.org/ )

The Perl columns of Randal L. Schwartz are available on the web at http://www.stonehenge.com/merlyn/WebTechniques/ , http://www.stonehenge.com/merlyn/UnixReview/ , and http://www.stonehenge.com/merlyn/LinuxMag/ .

網路上的 Perl:接觸 FTP 和 WWW

如果您想達到最好(還有最省錢)的傳輸效果,那麼從 http://www.cpan.org/SITES.html 所列的站臺中任選其一,從上頭把完整的對映站名單抓下來。然後您可以從中挑選一個對您來說傳輸最快的站臺。.PP 也可以使用 xx.cpan.org ,其中 "xx" 是雙字元的國家程式碼,例如澳大利亞可以使用 au.cpan.org. [注意:這隻對至少包含了一個主機映象的國家有效。]

有哪些討論 Perl 的郵件列表?

大部分的重要模組(如 Tk、CGI 和 libwww-perl)有專屬各自的 mailing lists。有關資料請參考這些模組的使用說明。

完整的與 Perl 有關的郵件列表可以從這裡找到:

        http://lists.perl.org/

comp.lang.perl.misc 的檔案庫

The Google search engine now carries archived and searchable newsgroup content.

http://groups.google.com/groups?group=comp.lang.perl.misc

If you have a question, you can be sure someone has already asked the same question at some point on c.l.p.m. It requires some time and patience to sift through all the content but often you will find the answer you seek.

如何購買商業版本的 Perl?

在某種程度上來說,Perl 已經算是商業軟體了:您可以把 Perl的發行約定拿來細讀給您的經理聽。各發行版都附有這份條例清楚、明確的公約。Perl有廣大的使用者及廣泛的文獻。comp.lang.perl.*等新聞討論群組和各電子郵遞論壇更是對各種疑難雜症提供迅速的解答。Perl 傳統上一直是由 Larry、許多軟體設計工程師,以及成千上萬的程式寫作者提供支援,大夥協力讓人人過更美好的日子。

儘管如此,有些主管堅持只向附售後保證的公司下訂單,這樣子出了問題才可以告他們,故以上的回答可能無法令這類的經理滿意。或許是這類的主管覺得亦步亦趨的扶持支援及很強的合約義務有其必要。市面上有賣用玻璃紙密封包裝的 Perl 光碟,您可以試試看,或許對您的經理有效。

Alternatively, you can purchase commercial incidence based support through the Perl Clinic. The following is a commercial from them:

"The Perl Clinic is a commercial Perl support service operated by ActiveState Tool Corp. and The Ingram Group. The operators have many years of in-depth experience with Perl applications and Perl internals on a wide range of platforms.

"Through our group of highly experienced and well-trained support engineers, we will put our best effort into understanding your problem, providing an explanation of the situation, and a recommendation on how to proceed."

Contact The Perl Clinic at

    www.PerlClinic.com

    North America Pacific Standard Time (GMT-8)
    Tel:    1 604 606-4611 hours 8am-6pm
    Fax:    1 604 606-4640

    Europe (GMT)
    Tel:    00 44 1483 862814
    Fax:    00 44 1483 862801

See also www.perl.com for updates on tutorials, training, and support.

如果發現 bugs要向何處報告?

如果您發現 perl解譯器或標準發行中的模組有 bugs ,想報知 perl 釋出小組的 話,請使用 perl發行中所附的 perlbug 程式,或將您的報告 email 到 perlbug@perl.org .

如果您想報告的 bug是有關某個非標準發行的 perl(詳見「哪些平臺上有 Perl ?」一題的答案)、某可執行檔形式的發行,或是某非標準的模組(譬如 Tk、CGI 等),那麼請參考它所附的使用說明,以確定最合適報告 bugs的地方。

詳情請見 perlbug(1) 手冊頁 (perl5.004 或更新版本)。

什麼是 perl.com? Perl Mongers? pm.org? perl.org? cpan.org?

The Perl Home Page at http://www.perl.com/ is currently hosted by The O'Reilly Network, a subsidiary of O'Reilly and Associates.

Perl Mongers is an advocacy organization for the Perl language which maintains the web site http://www.perl.org/ as a general advocacy site for the Perl language.

Perl Mongers uses the pm.org domain for services related to Perl user groups, including the hosting of mailing lists and web sites. See the Perl user group web site at http://www.pm.org/ for more information about joining, starting, or requesting services for a Perl user group.

Perl Mongers also maintain the perl.org domain to provide general support services to the Perl community, including the hosting of mailing lists, web sites, and other services. The web site http://www.perl.org/ is a general advocacy site for the Perl language, and there are many other sub-domains for special topics, such as

    http://bugs.perl.org/
    http://history.perl.org/
    http://lists.perl.org/
    http://use.perl.org/

http://www.cpan.org/ is the Comprehensive Perl Archive Network, a replicated worlwide repository of Perl software, see the What is CPAN? question earlier in this document.

AUTHOR AND COPYRIGHT

Copyright (c) 1997-2001 Tom Christiansen and Nathan Torkington. All rights reserved.

This documentation is free; you can redistribute it and/or modify it under the same terms as Perl itself.

Irrespective of its distribution, all code examples here are in the public domain. You are permitted and encouraged to use this code and any derivatives thereof in your own programs for fun or for profit as you see fit. A simple comment in the code giving credit to the FAQ would be courteous but is not required.

譯者

蕭百齡,兩隻老虎工作室

本頁面中文版由中文 man 手冊頁計劃提供。
中文 man 手冊頁計劃:https://github.com/man-pages-zh/manpages-zh

2003-11-25 perl v5.8.3