Ten reasons why every programmer should learn C Trac - 與Subversion整合
12月 19
  1. Perl is the oldest Web Programming Language, and then influences PHP, Python and Ruby. If you want to get those language started very fast, you better learn Perl first.
  2. Perl Compatible Regular Expression(PCRE) has many instances on utilitites and editors, and also on many Web Programming Languages. If you wish to match your text quickly, learn PCRE first.
  3. Perl provides programmers more than one way to write with flexible syntax, this also has effects on later Web Programming Languages such as Ruby.
  4. The main data structures of Perl are scalar, list, associative array. However string, regular expressions are also important. These are all essentials of later Web Programming Languages, through Perl that you will understand how to manipulate them with your code.
  5. Using Perl to wirte CGI code looks somehow inefficient, but helps you integrate other Client Side languages to it. Generating code with Perl’s string processing, reference or OOP also helps you get well to differences between Server Side and Client Side programming, and how to coordinate them.
  6. In those old years with Perl, we use CGI program to show HTML and process HTML forms. If you practice this now, you can know the structure of HTTP and the actual data a web server gets. When debugging in HTTP level, you will resolve the bug in a very short time. Most Web Programming Languages
  7. Perl can combine C libraries effectively, that’s how later Web Programming Languages make stable. Once your code needs acceleration, you can write C libraries to be used in your web application. Most Web Programming Languages for now support this way.
  8. Load mod_perl into your apache web server, this makes you realize how mod_php and modules for other language work. Use CGI wrappers to run your code if you find it hard to do so, and you will notice some security problems with your code.
  9. When reading Perl docs, or writing code with POD(perl’s documentation format) on it, you can use perldoc to generate API documentation. You will learn that writing code is writing beautiful documents.
  10. There is a huge software library called CPAN, you can use it to install libraries, or join software projects. You may learn how an opensource project works. CPAN has been running for 10 years, with 280 mirror sites, more than 5000 authors and 10000 libraries. This is a goal of most Web Programming Languages.

The purpose I write this article isn’t telling everyone to write your applicaiton with Perl. My previous article has talked about, I don’t even really want to write for now because Perl spend me a lot more time.
Many of Web Programmers depend on Framework and ignore essential of web technology.
Obviously, after learning a language like Perl (and resolve hard problems), they will understand what HTTP, Apache, CGI is. Myabe read some documents of it such as PCRE will help.

  1. Perl是最老的Web程式語言,因此也影響了後來的PHP,Python,Ruby。想要快速地上手這些新的程式語言,最好先熟習Perl的語法。Perl使用了許多符號作為關鍵字及運算子,後來一些Web程式語言也多半承襲這樣的方法。
  2. Perl相容的正規表示法(PCRE)影響了許多字串處理的工具程式及編輯器,當然也包括許多Web程式語言。現在如果你想寫正規表示法來比對你的字串,你得學PCRE。
  3. Perl的語法彈性提供了程式設計師們不只一種撰寫程式的語法,這個也影響了後來如Ruby這樣的Web程式語言。
  4. Perl的主要資料結構為純量,串列,關連陣列。此外字串,正規表示法也是相當重要。這些都是後來Web程式語言的主要元素,透過Perl你將瞭解如何操作這些要素來撰寫你的程式。
  5. 使用Perl撰寫CGI程式雖然看起來沒有效率,不過卻可以幫助你練習整合其他Client Side語言(如Javascript)至你的程式。利用Perl的字串處理,參考,或是物件導向來產生Client Side程式碼,有助於你瞭解Server Side和Client Side的差異,與如何協調溝通。
  6. 在過去Perl的年代是使用CGI的寫法來產生HTML表單和處理要求。藉此你可以瞭解HTTP的結構,與實際上Web Server所接收到的資料。當需要進行HTTP層級的除錯時,便能夠快速地瞭解這些符號的意義。現在多數的Web程式語言都已經將這些資料封裝起來,所以你無法瞭解HTTP層發生啥事。
  7. Perl能夠很有效地與C的函示庫做結合,這個作法也是後來的Web程式語言能夠穩定的原因。此外一旦你的程式需要加速,你也可以自行撰寫C函示庫來讓你的Web應用程式使用,目前多數的Web程式語言都支援這個方法。
  8. 學習如何將mod_perl在apache上設定,幫助你瞭解mod_php以及其他Web程式語言執行模組的載入方法。萬一你無法順利使用,你也可以學習使用CGI包裝程式(wrapper)執行這些程式,並瞭解Apache CGI的安全性問題。
  9. 學習閱讀Perl文件,或是撰寫在程式碼中撰寫POD(Perl的文件格式),利用perldoc產生文件,讓你瞭解撰寫程式的時候,同時也可以撰寫並產生美觀的文件讓人閱讀。
  10. Perl有很大的軟體庫稱做CPAN,透過使用CPAN安裝軟體函示庫,或參與開發,有助於你瞭解開放原始碼的社群如何運作。CPAN運作至今已經10年,現在有約280個鏡像站台,5千多個作者,及一萬多個函示庫,這是現在多數Web語言的學習對象及目標。

撰寫這篇文章的目的,並不是告訴大家要去學Perl。實際上在我的上一篇文章有提過,我自己都不見得想要真的來寫Perl,畢竟要花很多時間在打不少程式碼。

但是不容否認的是,撰寫過比較底層的Perl(也因為會遇上許多困難),對於瞭解HTTP,Apache,CGI等觀念有相當大的幫助。現在的Web Programmers多半依賴Framework, Language而忽略了他們在面對的本質還是這些。或許讀讀Perl的文件如PCRE應該也幫得上忙。

3 Responses to “Ten reasons why every web programmer should learn Perl”

  1. 路人甲 Says:

    雖然 perl 歷史悠久,影響後來的語言不少,但是要人學 perl 的話,這並不是個好理由.

  2. Kiwi Says:

    我瞭解你的想法,而我加了一些comments,來表達我當初寫這篇文章的目的。謝謝你的回應!

Leave a Reply