內容提要
本書是0’Reilly具有里程碑意義的Perl教科書系列的第三本,該系列包括《LearningPerl》(最為暢銷的一本介紹Perl基礎語法的書,簡體中文版由東南大學出版社出版)、《Intermediate Perl》(一本Perl程式設計師必備的指導如何創建可重用的Perl軟體的書)和《精通Perl》。《精通Perl》由淺入深地剖析了Perl特殊模組的工作機理、細緻詳盡地闡述了慣用的Perl 編程思想和技術,這些知識必能協助你在開發Perl程式時遊刃有餘,達成所需。
本書解釋了該如何:使用高級正則表達式,包括全局匹配、前後查詢匹配、可讀的正則表達式以及對正則表達式的調試;使用安全可靠的編程技術,避免常見的編程問題;剖析Perl運行時數據並作基準測試,繼而有針對性地進行性能最佳化;重新組織Perl代碼,使其更具自我表達力,增強可讀性;查看Perl如何實現對包變數的跟蹤維護,你可以用類似的技巧玩出更多有用的花樣來;動態定義子程式,從容化解普通過程式編程帶來的劣勢;臨時修改或調整相關的模組,在不修改原始碼的情況下修復代碼存在的問題;在不觸及代碼的情況下,讓用戶自行對程式進行配置;偵測Perl沒有報告的那些錯誤並向用戶匯報;套用Log4Perl模組,從Perl程式的運行日誌獲取有價值的信息;存儲相關數據以便後續再次運行該程式或其他程式時可以訪問該數據,以及如何通過網路傳送數據以Perl模組的形式編寫應用程式,以便使用現成的測試工具並輕鬆發布。
本書將帶你一路揭示這些問題的答案,讓你從容地成為能夠發現並解決疑難雜症的專家。
作者簡介
brian d foy是stonehenge Consulting Services公司的顧問,也是The Perl Review雜誌的出版者。他所創立的非營利性公司Perl Mongers,Inc.,已經在全球範圍內幫助籌建了200多個Perl用戶組。brian還維護著核心Perl文檔中的perlfaq部分,以及眾多發布到CPAN的模組。他還是Perl大會的演講常客,也是0’Reilly Network、The Perl Journal雜誌、Dr.Dobbs雜誌、use.perl.org站點和許多Perl Usenet新聞組的積極貢獻者。
目錄
Foreword
Preface
1. Introduction: Becoming a Master
What It Means to Be a Master
Who Should Read This Book
How to Read This Book
What Should You Know Already?
What I Cover
What I Don't Cover
2. Advanced Regular Expressions
References to Regular Expressions
Noncapturing Grouping, (?:PATTERN)
readableRegexes,/x and (?#...)
Global Matching
Lookarounds
Deciphering Regular Expressions
Final Thoughts
Summary
Further Reading
3. Secure Programming Techniques
Bad Data Can Ruin Your Day
Taint Checking
Untainting Data
List Forms of system and exec
Summary
Further Reading
4. Debugging Perl
Before You Waste Too Much Time
The Best Debugger in the World
perlSdb.pl
Alternative Debuggers
Other Debuggers
Summary
Further Reading
5. Profiling Perl
Finding theculprit
The General Approach
Profiling DBI
Devel: :DProf
Writing My Own Profiler
Profiling Test Suites
Summary
Further Reading
6. Benchmarking Perl
Benchmarking Theory
Benchmarking Time
Comparing Code
Don't Turn Off Your Thinking Cap
Memory Use
The perlbench Tool
Summary
Further Reading
7. Cleaning Up Perl
Good Style
perltidy
De-Obfuscation
Perl::Critic
Summary
Further Reading
8. SymboITablesandTypeglobs
Package and Lexical Variables
The Symbol Table
Summary
Further Reading
9. Dynamicsubroutines
Subroutines As Data
Creating and Replacing Named Subroutines
Symbolic References
Iterating Through Subroutine Lists
Processing Pipelines
Method Lists
Subroutines As Arguments
Autoloaded Methods
Hashes As Objects
AutoSplit
Summary
Further Reading
10. Modifying and Jury-riggingModules
Choosing the Right Solution
Replacing Module Parts
Subclassing
Wrapping Subroutines
Summary
Further Reading
11. Configuring Perl Programs
Things Not to Do
Better Ways
Command-Line Switches
Configuration Files
Scripts with a Different Name
Interactive and Noninteractive Programs
perl's Con fig
Summary
Further Reading
12. Detecting and Reporting Errors
Perl Error Basics
Reporting Module Errors
Exceptions
Summary
Further Reading
13. Logging
Recording Errors and Other Information
Eog4perl
Summary
Further Reading
14. Data Persistence
Flat Files
DBM Files
Summary
Further Reading
15. Working with Pod
The Pod Format
Translating Pod
Testing Pod
Summary
Further Reading
16. Working with Bits
Binary Numbers
Bit Operators
Bit Vectors
The vec Function
Keeping Track of Things
Summary
Further Reading
17. The Magic of Tied Variables
They Look Like Normal Variables
At the User Level
Behind the Curtain
Scalars
Arrays
Hashes
Filehandles
Summary
Further Reading
18. Modules As Programs
The main Thing
Backing Up
Who's Calling?
Testing the Program
Distributing the Programs
Summary
Further Reading
A. Further Reading
B. brian's Guide to Solving Any Perl Problem
Index