Table of Content Table of Content.........................................................................................................................i Copyright....................................................................................................................................v Dedication.............................................................................................................................vi Preface......................................................................................................................................vi Perlness................................................................................................................................vi Who Are You?.....................................................................................................................vii What This Book Covers.....................................................................................................vii Getting Perl.........................................................................................................................viii Typographical Conventions...............................................................................................ix For Further Reference........................................................................................................ix Perl Versions.........................................................................................................................x Acknowledgments................................................................................................................x Chapter 1. Introduction.............................................................................................................1 1.1 Reality..............................................................................................................................1 1.2 Why Perl?........................................................................................................................2 1.3 Know the Environment..................................................................................................3 1.4 Know the Language.......................................................................................................3 1.5 Online Documentation...................................................................................................4 1.6 References......................................................................................................................9 Chapter 2. The Zen of Perl Developing...............................................................................10 2.1 Attitudes.........................................................................................................................11 2.2 Beliefs............................................................................................................................12 2.3 Behavior........................................................................................................................13 2.4 Improve Your Craft......................................................................................................14 2.5 The Bottom Line...........................................................................................................14 Chapter 3. Antibugging..........................................................................................................15 3.1 Beginning......................................................................................................................15 3.2 Writing Code.................................................................................................................16 3.3 Observation...................................................................................................................19 3.4 Documentation.............................................................................................................20 3.5 Developing....................................................................................................................22 3.6 Accident Prevention.....................................................................................................23 3.7 Tips for Reducing Complexity....................................................................................26 Chapter 4. Perl Pitfalls...........................................................................................................29 4.1 Syntactical Sugaring....................................................................................................29 4.2 The Hall of the Precedence........................................................................................34 4.3 Regular Expressions...................................................................................................37 4.4 Miscellaneous...............................................................................................................37 Chapter 5. Tracing Code.......................................................................................................44 5.1 Dumping Your Data.....................................................................................................45 5.2 Making it Optional........................................................................................................46 5.3 Raise the Flag..............................................................................................................47 5.4 At Your Command.......................................................................................................48 5.5 Taking the Long Way Around....................................................................................50 Chapter 6. Testing Perl Programs........................................................................................52 6.1 Inspection Testing........................................................................................................53 6.2 Unit Testing...................................................................................................................54 6.3 System or Regression Testing...................................................................................56 6.4 Saturation Testing........................................................................................................59 6.5 Acceptance Testing.....................................................................................................59 6.6 References....................................................................................................................60 iii Chapter 7. The Perl Debugger..............................................................................................61 7.1 Basic Operation............................................................................................................61 7.2 Starting..........................................................................................................................62 7.3 Getting Graphical.........................................................................................................71 Chapter 8. Syntax Errors.......................................................................................................74 8.1 Typo Pathologies.........................................................................................................75 8.2 A Menagerie of Typos.................................................................................................80 Chapter 9. Run-time Exceptions...........................................................................................83 9.1 Symbolic References..................................................................................................84 9.2 Check That Return Code!...........................................................................................88 9.3 Taking Exception to Yourself.....................................................................................89 9.4 Playing Catch-Up.........................................................................................................90 9.5 Confession Is Good for the Soul...............................................................................92 Chapter 10. Semantical Errors.............................................................................................93 10.1 A Bit Illogical...............................................................................................................93 10.2 Reading Directories...................................................................................................94 10.3 But What Did It Mean?..............................................................................................95 10.4 printf Formats Don't Impose Context.................................................................98 10.5 Conditional my............................................................................................................98 10.6 Bringing Some Closure.............................................................................................99 Chapter 11. Resource Failure.............................................................................................100 11.1 Optimize for People First, Resources Later.........................................................100 11.2 Benchmark It!...........................................................................................................101 11.3 Making Things Better..............................................................................................107 Chapter 12. Perl as a Second Language..........................................................................113 12.1 Tips for Everyman....................................................................................................113 12.2 Tips for the C Programmer.....................................................................................114 12.3 Tips for the FORTRAN Programmer....................................................................115 12.4 Tips for the Shell Programmer...............................................................................116 12.5 Tips for the C++ or Java Programmer..................................................................117 Chapter 13. Debugging CGI Programs.............................................................................120 13.1 CGI.............................................................................................................................120 13.2 Web Servers.............................................................................................................121 13.3 500—Server Error....................................................................................................121 13.4 Basics........................................................................................................................122 13.5 Security.....................................................................................................................123 13.6 Heading Off Errors...................................................................................................125 13.7 cgi-test.......................................................................................................................126 13.8 Eavesdropping.........................................................................................................126 13.9 CGI.pm......................................................................................................................129 13.10 Command Line Testing........................................................................................130 13.11 Dying Young...........................................................................................................130 13.12 Debugger Interaction............................................................................................131 13.13 ptkdb........................................................................................................................133 Chapter 14. Conclusion.......................................................................................................134 14.1 Finis...........................................................................................................................134 14.2 The End.....................................................................................................................134 14.3 This Really Is the End.............................................................................................135 Appendix A. Perl Debugger Commands...........................................................................136 A.1 General Syntax..........................................................................................................136 A.2 Commands.................................................................................................................137 A.3 Options........................................................................................................................141 A.4 Environment Variables..............................................................................................143 Appendix B. Perls of Wisdom.............................................................................................145
剩余157页未读,继续阅读
评论0
最新资源