Perl 常見問題集

August 16, 1995

這份文件詳細描述了在 comp。lang。perl。misc 這個討論 Perl 程式設計的 Usenet 新聞群組裡所出現過的常見問題 及答案。 總共分為五個部份, 前三部份是屬於一般問題, 而第四, 五部 份則是與程式設計有關的。

如果這是你第一次接觸 Perl, 請在讀過這份文件及 perl(1) 說明文件 後再到 comp。lang。perl。misc 上問問題。 如果你在使用第四版的 Perl, 那麼這裡包涵了所有你須要知道(或最起碼多到夠讓你開始!)的資 料。 如果你使用第五版的 Perl, 這裡也會告訴你到那裡去找特定的資 料。 當我們說請參看 perlmod(1), 這句話表示請你去看 UNIX 上手冊 第 "1" 部份的 "perlmod" 說明文件, 又例如 Foo(3pm), 就是表示程式庫 裡第 "3pm"(perl 模組) 部份的 "Foo" 說明文件。 然而, Perl 安裝程式是 不會自動幫你安裝模組的說明文件的。

希望這裡所列出的問題夠多到能夠節省一些無謂的網路頻寬(如果問 之前先看一下的話!)。 也希望這裡所包涵的資訊夠多, 讓那些以前沒聽 說過 Perl 的人看了之後最起碼能夠對 Perl 有個大概的了解。

這裡有些問題並非真正和 Perl 有關, 而是與系統相關的問題。 你也可以參考 comp。unix。questions 裡的常見問題集, 那裡或許有這類問題的答案。

perl 最新的版本是 5。001 (譯註: 5。003), perl 5。000 誕生於 1994 年 十月 16 日。 前一個正式的版本是 4。036 (第四版, patchlevel 36)。 這裡面許多問題是 為了 Perl4 而寫的, 不過, 有很多關於 Perl5 的資訊也已經加入了。 若是專門 回答 Perl5 的相關問題, 問題前面會有記號, 使得那些仍然在使用 Perl4 的讀 者不會混淆。 儘管如此, 你還是應該儘可能快點升級到 Perl5 比較好。

This list was initially written, and still hacked upon, by Tom Christiansen*。 However, due to his erratic schedule, it is currently maintained by Stephen P Potter*。 First person singular pronouns, when not in quoted postings, generally are Tom talking。

This document, and all its parts, are Copyright (c) 1994/1995, Stephen P Potter and Tom Christiansen, perlfaq@perl。com。 All rights reserved。 HTML by Tom Christiansen。 Permisson to distribute this collection, in part or full, via electronic means (emailed, posted or archived) or printed copy are granted providing that no charges are involved, reasonable attempt is made to use the most current version, and all credits and copyright notices are retained。 Requests for other distribution rights, including incorporation in commercial products, such as books, magazine articles, or CD-ROMs should be made to perlfaq@perl。com。

This FAQ is archived on ftp。cis。ufl。edu [128。227。100。198] in the file pub/perl/doc/FAQ, as well as on rtfm。mit。edu [18。181。0。24] in /pub/usenet/comp。lang。perl。*。 If you have any suggested additions or corrections to this article, please send them to


General Information and Availability


1。1) 什麼是 Perl?
1。2) 什麼是 perl4 和 perl5, 他們有什麼不同呢?
1。3) perl5 提供了哪些比 perl4 好的特點呢?
1。4) 我可以在哪裡拿到 perl5 的文件?
1。5) perl5 是否無法順利執行我的 perl4 腳本呢?
1。6) Perl 何時才會穩定下來呢?
1。7) "perl" 和 "Perl" 有什麼不同呢?
1。8) 我該說它是一個 perl 程式或是一個 perl 腳本呢?
1。9) perl 很難學嗎?
1。10) 我應該用 perl 來寫所有的程式嗎?
1。11) perl 和其他腳本語言比較起來怎樣? 像 Tcl, Python 或 REXX?
1。12) 我如何在 Internet (FTP) 上拿到 Perl?
1。13) 我如何利用 email 去抓 Perl?
1。14) 我如何利用 UUCP 去抓 Perl?
1。15) 是否有其他方法可以抓到 perl 呢?
1。16) perl 已經被移植到 FOO 平台上了嗎?
1。17) 我該如何在 Solaris 作業系統下編譯 Perl?
1。18) 我該如何在一台 NeXT 機器上編譯 Perl?
1。19) Perl 有哪些可用的擴充模組[extensions]而我又可以在哪裡拿到他們呢?
1。20) dbperl 是什麼而我又可以在哪裡拿到它呢?
1。21) dbperl 是什麼而我又可以在哪裡拿到它呢?
1。22) 有具備控制 SNMP 能力的 perl 嗎?
1。23) Perl 有 ISO 或 ANSI 認證過的版本嗎?

1。1) 什麼是 Perl?

Perl 是一種編譯過的腳本化語言, 她的作者是Larry Wall*

以下是由 perl(1) 說明文件的開頭所節錄下來的敘述:

Perl 是一種直譯式語言, 專門用來掃瞄任意的文字檔案, 從中取得資訊 並且根據這些資訊印出報告來。 她也很適合許多系統管理的工作。 這個 語言傾向於實用(好用, 有效率, 完整),而非漂亮(精簡, 優雅, 最小化 )。 她綜合了(根據作者的看法), C, sed, awk 和 sh 的眾多優點, 所以熟悉 這些語言的人們應該對 Perl 也不會有什麼問題。 (語言歷史學者也許會 注意到一些 csh, Pascal, 甚至於 Basic-Plus 的遺蹟在其中。) Perl 表現式的 語法相當接近於 C 的。 不過跟大多數 Unix 上的工具不同的是, Perl 並不 會隨意限制你的資料大小。 事實上若你有夠大的記憶體, perl 可以把你的 整個檔案當作一個字串來處理。 Recursion 的深度也是沒有限制的。 Associative arrays 所用的 Hash tables 也會依須要而變大以免拖慢了速度。 Perl 採用複雜的模式查核技術[pattern matching techniques]以快速掃瞄大量的 資料。 Perl 並非只專精於掃瞄文字, 她也可以處理 binary 資料, 也可以讓 dbm 檔案看來像個 associative array (只要提供 dbm 的功能!)。 Setuid 的 perl 腳本也比 C 程式安全多了, 因為她採用一個資料流追蹤機制, 用來防止許多 愚笨的安全漏洞。 如果你的問題通常都用 sed, awk 或 sh 來做, 但是卻覺得處 理這問題超越了它們的能力, 或是你希望更快得到結果卻又不想用 C 寫這 麼愚蠢的東西, 那麼 perl 就是你該考慮的選擇了。 現在也有轉換器可以把你 的 sed 和 awk 腳本轉成 perl 腳本。 好了! 扯得夠多了!

1。2) 什麼是 perl4 和 perl5, 他們有什麼不同呢?

Perl4 和 Perl5 是這語言的不同版本。 Perl4 是先推出的, 而 perl5 是第二代的 Perl [Perl: The Next Generation]。 Perl5 基本上可以說 是 perl 原始碼的重新撰寫。 她已經被模組化, 物件導向化, tweaked, trimmed 和最佳化到幾乎看不出和舊原始碼相似之處了! 然而, 介面 基本上還是一樣的, 而且和舊版本的相容性也很高。

1。3) perl5 提供了哪些比 perl4 好的特點呢?

如果你拿到了最新的原始碼, 你會看到一個放滿說明文件[man page]的目錄(大概 會被安裝在第 1p 和 3pm 部份)。這些說明文件中討論到 perl5 和 perl4 的相異 處, 新特點, 和舊版不相容處以及其他更多東西。然而, 此處只是重點式地列出一 些新特徵以及和舊版本的不相容之處。 (Thanks to Tom Christiansen* for this section)

1。4) 我可以在哪裡拿到 perl5 的文件?

The complete perl documentation is available with the Perl distribution, or can be accessed from the following sites。 Note that the PerlDoc ps file is 240 pages long!!
Marked Up (HTML) format:
http://www。metronet。com/0/perlinfo/perl5/manual/perl。html
http://web。nexor。co。uk/perl/perl。html                       (Europe)
    
PostScript:
ftp://ftp。cis。ufl。edu/pub/perl/doc/PerlDoc。ps。gz
ftp://ftp。uu。net/languages/perl/PerlDoc。ps。gz
ftp://www。metronet。com/pub/perl/perl5/manual/PerlDoc。ps。gz
ftp://ftp。zrz。tu-berlin。de/pub/unix/perl/PerlDoc。ps。gz  (Europe)
ftp://ftp。cs。ruu。nl/pub/PERL/perl5。0/doc/PerlDoc。ps。gz  (Europe)
ftp://sungear。mame。mu。oz。au/pub/perl/doc/PerlDoc。ps。gz  (Oz)
        unable to access as of 7/15/95
TeXinfo (Emacs) Format:
ftp://www。metronet。com/pub/perl/perl5/manual/perl5-info。tar。gz
    

1。5) perl5 是否無法順利執行我的 perl4 腳本呢?

In general, no。 However, certain bad old practices have become highly frowned upon。 The following are the most important of the known incompatibilities between perl4 and perl5。 See perltrap(1) for more details。

1。6) Perl 何時才會穩定下來呢?

When asked at what point the Perl code would be frozen, Larry answered:
Part of the redesign of Perl is to allow us to more or less freeze the language itself。 It won't totally freeze, of course, but I think the rate of change of the core of the language is asymptotically approaching 0。 In fact, as time goes on, now that we have an official extension mechanism, some of the things that are currently in the core of the language may move out (transparently) as extensions。 This has already happened to dbmopen()。

I've also been continuously reminding myself of what Henry Spencer calls ``second system syndrome'', in which everything under the sun gets added, resulting in a colossal kludge, like OS 360。 You'll find that the new features in Perl 5 are all pretty minimalistic。 The object-oriented features in particular added only one new piece of syntax, a C++-style method call。

The whole idea behind Perl is to be a fast text-processing, system-maintenance, zero-startup time language。 If it gets to be so large and complicated that it isn't fast-running and easy to use, it won't be to anyone's benefit。
My motto from the start has been, ``If it ain't broke, don't fix it。'' I've been trying very hard not to remove those features from Perl that make it what it is。 At the same time, a lot of streamlining has gone into the syntax。 The new yacc file is about half the size of the old one, and the number of official reserved words has been cut by 2/3。 All built-in functions have been unified (dualified?) as either list operators or unary operators。
I really like a lot of the features in Perl, but in order for Perl to be useful on a long term basis, those features have to stay put。 I bought the Camel book less than a year ago and it sounds like within another year it will be obsolete。
The parts of Perl that the Camel book covers have not changed all that much。 Most old scripts still run。 Many scripts from Perl version 1。0 still run。 We'll certainly be revising the Camel, but the new man pages are split up such that it's pretty easy to ferret out the new info when you want it。

We did break a few misfeatures in going to Perl 5。 It seemed like the first and last chance to do so。 There's a list of the incompatibilities in the documentation。

Not only is it a lot of work to recompile Perl on 20+ machines periodically, but it's hard to write scripts that are useful in the long term if the guts of the language keep changing。 (And if I keep having to buy new books。 I keep hearing about new features of Perl 5 that aren't documented in any of the perl 5 documentation that I can find。)
I think you'll find a lot of folks who think that 4。036 has been a pretty stable platform。

Perl 5 is a special case。 I've been working on it for years。 (This is part of the reason 4。036 has been so stable!) There are many changes, most of them for the better, I hope。 I don't expect the transition to be without pain。 But that's why I stuck numbered versions out in your bin directory, so that you can upgrade piecemeal if you like。 And that's why I made the -w switch warn about many of the incompatibilities。

And overriding all that, I've tried to keep it so that you don't have to know much about the new stuff to use the old stuff。 You can upgrade your knowledge piecemeal too。

The extension mechanism is designed to take over most of the evolutionary role from now on。 And it's set up so that, if you don't have a particular extension, you know it right up at the front。

Are there any plans to write a Perl compiler? While interpreted Perl is great for many applications, it would also be cool to be able to precompile many scripts。 (Yes, I know you can undump things, but undump isn't provided with Perl and I haven't found a copy。) The creation of a perl library and dynamically-loadable modules seems like a step in that direction。
Yes, part of the design of Perl 5 was to make it possible to write a compiler for it。 It could even be done as an extension module, I suppose。 Anyone looking for a master's thesis topic?

In summary, almost every concern that you might think of has already been (at least) thought about。 In a perfect world, every concern could be addressed perfectly。 But in this world we just have to slog through。

1。7) "perl" 和 "Perl" 有什麼不同呢?

    32!  [ ord('p') - ord('P') ]
    

Larry now uses ``Perl'' to signify the language proper and ``perl'' the implementation of it, i。e。 the current interpreter。 Hence Tom's quip that ``Nothing but perl can parse Perl。''

On the other hand, the aesthetic value of casewise parallelism in ``awk'', ``sed'', and ``perl'' as much require the lower-case version as ``C'', ``Pascal'', and ``Perl'' require the upper-case version。 It's also easier to type ``Perl'' in typeset print than to be constantly switching in Courier。 :-)

In other words, it doesn't matter much, especially if all you're doing is hearing someone talk about the language; case is hard to distinguish aurally。

1。8) 我該說它是一個 perl 程式或是一個 perl 腳本呢?

It depends on whether you are talking about the perl binary or something that you wrote using perl。 And, actually, even this isn't necessarily true。

``Standard'' UNIX terminology is (roughly) this: programs are compiled into machine code once and run multiple times, scripts are translated (by a program) each time they are used。 However, some say that a program is anything written which is executed on a computer system。 Larry considers it a program if it is set in stone and you can't change it, whereas if you can go in and hack at it, it's a script。 Of course, if you have the source code, that makes just about anything a script。 ;)

In general, it probably doesn't really matter。 The terms are used interchangeably。 If you particularly like one or the other, use it。 If you want to call yourself a perl programmer, call them programs。 If you want to call yourself a perl scripter, call them scripts。 Randal* and I (at least) will call them hacks。 (See question 2。10 ;)

Larry says that a script is what you give an actor, but a program is what you give an audience。

1。9) perl 很難學嗎?

Not at all。 Many people find Perl extremely easy to learn。 There are at least three main reasons for this。

The first reason is that most of Perl has been derived from standard utilities, tools, and languages that you are (probably) already familiar with。 If you have any knowledge of the C programming language and standard C library, the Unix Shell, sed and awk, Perl should be simple and fun for you to learn。

The second reason that Perl is easy to learn is that you only have to know a very small subset of Perl to be able to get useful results。 In fact, once you can master

    #!/usr/local/bin/perl
    print "Hello, world\n";
you can start writing Perl scripts。 In fact, you will probably never have to (or be able to) know everything about Perl。 As you feel the need or desire to use more sophisticated features (such as C structures or networking), you can learn these as you go。 The learning curve for Perl is not a steep one, especially if you have the headstart of having a background in UNIX。 Rather, its learning curve is gentle and gradual, but it is admittedly rather long。

The third reason is that you can get immediate results from your scripts。 Unlike a normal compiled language (like C or Pascal, for example), you don't have to continually recompile your program every time you change one little thing。 Perl allows you to experiment and test/debug quickly and easily。 This ease of experimentation flattens the learning curve even more。

If you don't know C or UNIX at all, it'll be a steeper learning curve, but what you then learn from Perl will carry over into other areas, like using the C library, UNIX system calls, regular expressions, and associative arrays, just to name a few。 To know Perl is to know UNIX, and vice versa。

1。10) 我應該用 perl 來寫所有的程式嗎?

Most definitely。 In fact, you should delete the binaries for sed, awk, cc, gcc, grep, rm, ls, cat。。。 well, just delete your /bin directory。

But seriously, of course you shouldn't。 As with any job, you should use the appropriate tool for the task at hand。 Just because a hammer will put screws into a piece of board, you probably don't want to do that。

While it's true that the answer to the question ``Can I do (some arbitrary task) in Perl?'' is almost always ``yes'', that doesn't mean this is necessarily a good thing to do。 For many people, Perl serves as a great replacement for shell programming。 For a few people, it also serves as a replacement for most of what they'd do in C。 But for some things, Perl just isn't the optimal choice。

1。11) perl 和其他腳本語言比較起來怎樣? 像 Tcl, Python 或 REXX?

REXX is an interpreted programming language first seen on IBM systems。 Python is an interpreted programming language by Guido van Rossum*。 TCL is John Ousterhout*'s embeddable command language, designed just for embedded command extensions, but lately used for larger applications。 TCL's most intriguing feature for many people is the tcl/tk toolset that allows for interpreted X-based tools。 Others use it for its ``expect'' extension。

To avoid any flamage, if you really want to know the answer to this question, probably the best thing to do is try to write equivalent code to do a set of tasks。 All three have their own newsgroups in which you can learn about (but hopefully not argue about) these languages。

To find out more about these or other languages, you might also check out David Muir Sharnoff*'s posting ``Catalog of Compilers, Interpreters, and Other Language Tools'' which he posts to comp。lang。misc, comp。sources。d, comp。archives。admin, and news。answers newsgroups。 It's a comprehensive treatment of many different languages。 (Caveat lector: he considers Perl's syntax ``unappealing''。)

1。12) 我如何在 Internet (FTP) 上拿到 Perl?

Perl is available from any comp。sources。misc archive。 You can use an archie server (see the alt。sources FAQ in news。answers) to find these if you want。

Version 4:
Volume  Issues  Patchlevel and Notes
------  ------  ------------------------------------------------
  18    19-54   Patchlevel 3, Initial posting。
  20    56-62   Patches 4-10

Version 5:
Volume  Issues  Patchlevel and Notes
------  ------  -----------------------------------------------
  45    64-128  Initial Posting, patchlevel 0。
Since 1993, a number of archives have sprung up specifically for Perl and Perl related items。 Larry maintains the official distribution site (for both perl4。036 and perl5) at netlabs。 Probably the largest archive is at the University of Florida。 In order of probability these sites will have the sources。

Site    Directory and notes                         IP
---------------------------------------------       -------

North America:
ftp://ftp。netlabs。com/pub/outgoing/perl5。0/         192。94。48。152
ftp://ftp。cis。ufl。edu/pub/perl/src/5。0/             128。227。100。198
ftp://prep。ai。mit。edu/pub/gnu/                      18。71。0。38
        not current as of 7/15/95
ftp://ftp。uu。net/languages/perl/                    192。48。96。9
        not current as of 7/15/95
ftp://ftp。khoros。unm。edu/pub/perl/                  198。59。155。28
        not current as of 7/15/95
ftp://ftp。cbi。tamucc。edu/pub/duff/Perl/             165。95。1。3
ftp://ftp。metronet。com/pub/perl/sources/            192。245。137。1
ftp://genetics。upenn。edu/perl5/                     128。91。200。37

Europe:
ftp://ftp。cs。ruu。nl/pub/PERL/perl5。0/src/           131。211。80。17
ftp://ftp。funet。fi/pub/languages/perl/ports/perl5/  128。214。248。6
ftp://ftp。zrz。tu-berlin。de/pub/unix/perl/           130。149。4。40
ftp://src。doc。ic。ac。uk/packages/perl5/              146。169。17。5

Australia:
ftp://sungear。mame。mu。oz。au/pub/perl/src/5。0/       128。250。209。2

South America (mirror of ftp://prep。ai。mit。edu/pub/gnu):
ftp://ftp。inf。utfsm。cl/pub/gnu/                     146。83。198。3

If there is a site in Asia or Japan, please tell us about it。 Thanks!

You can also retrieve perl via non-ftp methods:

http://src。doc。ic。ac。uk/packages/perl5/             146。169。17。5
gopher://src。doc。ic。ac。uk/0/packages/perl5/         146。169。17。5

1。13) 我如何利用 email 去抓 Perl?

The following is a list of known ftpmail sites。 Please attempt to use the site closest to you with the ftp archive closest to it。 Many of these sites already have perl on them。 For information on how to use one of these sites, send email containing the word ``help'' to the address。

    United States:
        Massachusetts:      ftpmail@decwrl。dec。com
        New Jersey:         bitftp@pucc。princeton。edu
        North Carolina:     ftpmail@sunsite。unc。edu

    Europe/UK:
        Germany:            ftpmail@ftp。uni-stuttgart。de
                            bitftp@vx。gmd。de
        UK:                 ftpmail@doc。ic。ac。uk

    Australia:              ftpmail@cs。uow。edu。au
Henk P Penning* suggests that if you are in Europe you should try the following (if you are in Germany or the UK, you should probably use one of the servers listed above):
    Email: Send a message to 'mail-server@cs。ruu。nl' containing:
     begin
     path your_email_address
     send help
     send PERL/perl5。0/INDEX
     end
    The path-line may be omitted if your message contains a normal
    From:-line。  You will receive a help-file and an index of the
    directory that contains the Perl stuff。

If all else fails, mail to Larry usually suffices。

1。14) 我如何利用 UUCP 去抓 Perl?

There currently is no way of getting Perl via UUCP。 If anyone knows of a way, please contact me。 The OSU site has discontinued the service。

1。15) 是否有其他方法可以抓到 perl 呢?

Another possibility is to use UUNET, although they charge you for it。 You have been duly warned。 Here's the advertisement:

Anonymous Access to UUNET's Source Archives
1-900-GOT-SRCS

UUNET now provides access to its extensive collection of UNIX related sources to non- subscribers。 By calling 1-900-468-7727 and using the login ``uucp'' with no password, anyone may uucp any of UUNET's on line source collection。 Callers will be charged 40 cents per minute。 The charges will appear on their next tele- phone bill。

The file uunet!/info/help contains instructions。 The file uunet!/index//ls-lR。Z contains a complete list of the files available and is updated daily。 Files ending in Z need to be uncompressed before being used。 The file uunet!~/compress。tar is a tar archive containing the C sources for the uncompress program。

This service provides a cost effective way of obtaining current releases of sources without having to maintain accounts with UUNET or some other service。 All modems connected to the 900 number are Telebit T2500 modems。 These modems support all standard modem speeds including PEP, V。32 (9600), V。22bis (2400), Bell 212a (1200), and Bell 103 (300)。 Using PEP or V。32, a 1。5 megabyte file such as the GNU C compiler would cost $10 in con- nect charges。 The entire 55 megabyte X Window system V11 R4 would cost only $370 in connect time。 These costs are less than the official tape distribution fees and they are available now via modem。

UUNET Communications Services
3110 Fairview Park Drive, Suite 570
Falls Church, VA 22042
+1 703 876 5050 (voice)
+1 703 876 5059 (fax)
info@uunet。uu。net

1。16) perl 已經被移植到 FOO 平台上了嗎?

Perl runs on virtually all Unix machines simply by following the hints file and instructions in the Configure script。 This auto-configuration script allows Perl to compile on a wide variety of platforms by modifying the machine specific parts of the code。 For most Unix systems, or VMS systems for v5 perl, no porting is required。 Try to compile Perl on your machine。 If you have problems, examine the README file carefully。 If all else fails, send a message to comp。lang。perl。misc and crosspost to comp。sys。[whatever], there's probably someone out there that has already solved your problem and will be able to help you out。

Perl4。036 has been ported to many non-Unix systems, although currently there are only a few (beta) v5 ports。 All of the following are mirrored at ftp://ftp。cis。ufl。edu:/pub/perl/src/。 The following are the (known) official distribution points。 Please contact the porters directly (when possible) in case of questions on these ports。

1。17) 我該如何在 Solaris 作業系統下編譯 Perl?

The following directions are for perl, version 4。 Perl, version 5, should compile more easily。 If not, send mail to The Perl Porters Mailing List (perl5-porters@nicoh。com)

John Lees* reports:

I have built perl on Solaris 2。1, 2。2 beta, and 2。2 FCS。 Take /usr/ucb out of your path and do not use any BSD/UCB libraries。 Only -lsocket, -lnsl, and -lm are needed。 You can use the hint for Solaris 2。0, but the one for 2。1 is wrong。 Do not use vfork。 Do not use -I/usr/ucbinclude。 The result works fine for me, but of couse does not support a couple of BSDism's。

Casper H。S。 Dik* reports

You must remove all the references to /usr/ucblib AND /usr/ucbinclude。 And ignore the Solaris_2。1 hints。 They are wrong。 The undefining of vfork() probably has to do with the confusion it gives to the compilers。 If you use cc, you mustn't compile util。c/tutil。c with -O。 I only used the following libs: -lsocket -lnsl -lm (there is a problem with -lmalloc)

Michael D'Errico* reports:

If you are using Solaris 2。x, the signal handling is broken。 If you set up a signal handler such as 'ripper' it will be forgotten after the first time the signal is caught。 To fix this, you need to recompile Perl。 Just add '#define signal(x,y) sigset((x),(y))' after the '#include ' directive in each file that it occurs, then make it again。

1。18) 我該如何在一台 NeXT 機器上編譯 Perl?

According to Andreas Koenig*, under NeXTstep 3。2, both perl4。036 and perl5。000 compile with the supplied hints file。

However, Bill Eldridge* provides this message to help get perl4。036 on NeXTstep 3。0 to work:

To get perl to compile on NeXTs, you need to combine the ANSI and BSD headers:

    cd /usr/include
    mkdir ansibsd
    cd ansibsd
    ln -s 。。/ansi
    ln -s 。。/bsd

Then, follow the configuration instructions for NeXTs, replacing all mention of -I/usr/include/ansi or -I/usr/include/bsd with -I/usr/include/ansibsd。

1。19) Perl 有哪些可用的擴充模組[extensions]而我又可以在哪裡拿到他們呢?

Some of the more popular extensions include those for windowing, graphics, or data base work。 Most of the major sites contain an archive of the extensions, usually in the ext directory。 Since the list of available extensions changes so often, I have opted to list only the sites and directories, not the individual extensions, please check the closest archive for more information

1。20) dbperl 是什麼而我又可以在哪裡拿到它呢?

Many database-oriented extensions to Perl have been written。 Basically, these use the usub mechanism (see the usub/ subdirectory) in the source distribution) to link in a database library, allowing embedded calls to Informix, Ingres, Interbase, Oracle and Sybase。

Here are the authors of the various extensions:

What            Target DB       Who
--------        -----------     ----------------------------------------
?Infoperl       Informix        Kurt Andersen (kurt@hpsdid。sdd。hp。com)
Ingperl         Ingres          Tim Bunce (timbo@ig。co。uk) and Ted Lemon
Interperl       Interbase       Buzz Moschetti (buzz@bear。com)
Isqlperl        Informix        William Hails bill@tardis。co。uk
Oraperl         Oracle          Kevin Stock (kstock@Auspex。com)
Pgperl          Postgres        Igor Metz (metz@iam。unibe。ch)
*Sqlperl        Ingres          Ted Lemon (mellon@ncd。com)
Sybperl         Sybase          Michael Peppler (mpeppler@itf。ch)
Uniperl         Unify 5。0       Rick Wargo (rickers@coe。drexel。edu)

    ? Does this one still exist?
    
*Sqlperl appears to have been subsumed by Ingperl

Buzz Moschetti* has organized a project to create a higher level interface to allow you to write your queries in a database-independent fashion。 If this type of project interests you, send mail to <perldb-interest-request@vix。com> and asked to be placed on the ``perldb-interest'' mailing lists。

Here's a bit of advertising from Buzz:

Perl is an interpreted language with powerful string, scalar, and array processing features developed by Larry Wall that ``nicely bridges the functionality gap between sh(1) and C。'' Since relational DB operations are typically textually oriented, perl is particularly well-suited to manage the data flows。 The C source code, which is available free of charge and runs on many platforms, contains a user-defined function entry point that permits a developer to extend the basic function set of the language。 The DBperl Group seeks to exploit this capability by creating a standardized set of perl function extensions (e。g。 db_fetch(), db_attach()) based on the SQL model for manipulating a relational DB, thus providing a portable perl interface to a variety of popular RDMS engines including Sybase, Oracle, Ingres, Informix, and Interbase。 In theory, any DB engine that implements a dynamic SQL interpreter in its HLI can be bolted onto the perl front end with predicatable results, although at this time backends exist only for the aforementioned five DB engines。

The official archive for DBperl extensions is ftp://ftp。demon。co。uk/pub/perl/db It's the home of the evolving DBperl API Specification。 Here's an extract from the updated README there:


DBI/        The home of the DBI archive。 To join the DBI mailing list
            send your request to perldb-interest-REQUEST@vix。com

DBD/        Database Drivers for the DBI 。。。

Oracle/      By Tim Bunce (not yet ready!)
Ingres/      By Tim Bunce (not yet started!)

mod/           Other Perl 5 Modules and Extensions 。。。

Sybperl/    By Michael Peppler, mpeppler@itf。ch

perl4/         Perl 4 extensions (using the usub C interface)

   oraperl/   ORACLE 6 & 7  By Kevin Stock, kstock@auspex。com
   sybperl/   SYBASE 4      By Michael Peppler, mpeppler@itf。ch
   ingperl/   INGRES        By Tim Bunce timbo@ig。co。uk and Ted Lemon
   isqlperl/  INFORMIX      By William Hails, bill@tardis。co。uk
   interperl/ INTERBASE     By Buzz Moschetti, buzz@bear。com
   oraperl/   ORACLE 6 & 7  By Kevin Stock (sadly no longer on the net)
   sybperl/   SYBASE 4      By Michael Peppler, mpeppler@itf。ch
   ingperl/   INGRES        By Tim Bunce timbo@ig。co。uk and Ted Lemon
   isqlperl/  INFORMIX      By William Hails, bill@tardis。co。uk
   interperl/ INTERBASE     By Buzz Moschetti, buzz@bear。com
   uniperl/   UNIFY 5。0     By Rick Wargo, rickers@coe。drexel。edu
   pgperl/    POSTGRES      By Igor Metz, metz@iam。unibe。ch

   btreeperl/ NDBM perl extensions。   By John Conover, john@johncon。com
   ctreeperl/ C-Tree perl extensions。 By John Conover, john@johncon。com
   duaperl/   X。500 Directory User Agent。 By Eric Douglas。

scripts/       Perl and shell scripts

   rdb/       RDB is a perl RDBMS for ASCII files。 By Walt Hobbs,
                hobbs@rand。org
   shql/      SHQL is an interactive SQL database engine。  Written as a
                shell script, SHQL interprets SQL commands and
                manipulates flat files based on those commands。 By
                Bruce Momjian, root@candle。uucp
   xbase/     Perl scripts for accessing xBase style files (dBase III)

refinfo/       Reference information

   sqlsyntax/ Yacc and lex syntax and C source code for SQL1 and SQL2
        from ftp。uu。net:/pub/uunet/published/oreilly/nutshell/yacclex,
        and a draft SQL3 syntax from Jeff Fried <jfried@informix。com>+
   formats/   Details of file formats such as Lotus 1-2-3 。WK1

There are also a number of non SQL database interfaces for perl available from ftp。demon。co。uk。 These include:

Directory   Target System   Authors and notes
---------   -------------   -------------------------------------------
btreeperl   NDBM extension  John Conover (john@johncon。com)
ctreeperl   CTree extension John Conover (john@johncon。com)
duaperl     X。500 DUA       Eric Douglas
rdb         RDBMS           Walt Hobbs (hobbs@rand。org)
shql        SQL Engine      Bruce Momjian (root@candle。uucp)

1。21) dbperl 是什麼而我又可以在哪裡拿到它呢?

As shipped, Perl (version 5) comes with interfaces for several DBM packages (SDBM, old DBM, NDBM, GDBM, Berkeley DBM) that are not supplied but either come with your system are readily accessible via FTP。 SDBM is guaranteed to be there。 For a comparison, see AnyDBM_File(3pm) and DB_File(3pm)

1。22) 有具備控制 SNMP 能力的 perl 嗎?

snmperl was written by Guy Streeter (streeter@ingr。com), and was posted in late February 1993 to comp。protocols。snmp。 It can be found archived at one of two (known) places:

Host liasun3。epfl。ch
Location: /pub/net/snmp
       FILE -rw-rw-r--       3407  Aug 11 1992  snmperl。README
       FILE -rw-r--r--      17678  Aug 11 1992  snmperl。tar。Z

Host ftp。cis。ufl。edu
Location: /pub/perl/scripts/snmp

Here is the gist of the README:

This directory contains the source code to add callable C subroutines to perl。 The subroutines implement the SNMP functions ``get'', ``getnext'', and ``set''。 They use the freely-distributable SNMP package (version 1。1b) from CMU。

USE: There are four subroutines defined in the callable interface: snmp_get, snmp_next, snmp_set, and snmp_error。

snmp_get and snmp_next implement the GET and GETNEXT operations, respectively。 The first two calling arguments are the hostname and Community string。 The IP address of the host, as a dotted-quad ASCII string, may be used as the hostname。 The rest of the calling arguments are a list of variables。 See the CMU package documentation for how variables may be specified。

snmp_set also takes hostname and Community string as arguments。 The remaining arguments are a list of triples consisting of variable name, variable type, and value。 The variable type is a string, such as ``INTEGER'' or ``IpAddress''。

snmp_get, snmp_next, and snmp_set return a list containing alternating variables and values。 snmp_get and snmp_next will simply omit non-existent variables on return。 snmp_set will fail completely if one of the specified variables does not exist (or is read-only)。

snmp_error will return a text string containing some error information about the most recent snmp_get|next|set call, if it had an error。

OTHER NOTES:
I didn't find all the places where the CMU library writes to stderr or calls exit() directly。

The changes I made to mib。c involve the formatting of variable values for return to the caller。 I took out the descriptive prefix so the string contains only the value。

Enumerated types are returned as a string containing the symbolic representation followed in parentheses by the numeric。

DISTRIBUTION and OWNERSHIP

perl and the CMU SNMP package have their own statements。 Read them。 The work I've done is free and clear。 Just don't say you wrote it if you didn't, and don't say I wrote it if you change it。

    Guy Streeter
    streeter@ingr。com
    April 1, 1992 (not a joke!)

1。23) Perl 有 ISO 或 ANSI 認證過的版本嗎?

No。 Larry thinks it likely that he'll be certified before perl is。