O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Perl Debugged

Book Description

"This book was a joy to read. It covered all sorts of techniques for debugging, including 'defensive' paradigms that will eliminate bugs in the first place. As coach of the USA Programming Team, I find the most difficult thing to teach is debugging. This is the first text I've even heard of that attacks the problem. It does a fine job. Please encourage these guys to write more."–Rob Kolstad

Perl Debugged provides the expertise and solutions developers require for coding better, faster, and more reliably in Perl. Focusing on debugging, the most vexing aspect of programming in Perl, this example-rich reference and how-to guide minimizes development, troubleshooting, and maintenance time resulting in the creation of elegant and error-free Perl code.

Designed for the novice to intermediate software developer, Perl Debugged will save the programmer time and frustration in debugging Perl programs. Based on the authors’ extensive experience with the language, this book guides developers through the entire programming process, tackling the benefits, plights, and pitfalls of Perl programming. Beginning with a guided tour of the Perl documentation, the book progresses to debugging, testing, and performance issues, and also devotes a chapter to CGI programming in Perl. Throughout the book, the authors espouse defensible paradigms for improving the accuracy and performance of Perl code. In addition, Perl Debugged includes Scott and Wright’s "Perls of Wisdom" which summarize key ideas from each of the chapters, and an appendix containing a comprehensive listing of Perl debugger commands.

In this exceptional reference and debugging guide, the authors cover every aspect of efficient Perl programming, including:

  • CGI programming–special tips for debugging this type of Perl program

  • How to develop the proper mindset for developing and programming effectively in Perl

  • Perl "gotchas"–how to understand them, work around them, and avoid them

  • "Antibugging"–the authors’ rules of thumb on how to code defensively

  • The Perl debugger –the authors’ guide to using this Perl built-in

  • Common syntax errors and how to track down their causes

  • Semantical errors–why code may appear correct but the programs do not work

  • How to improve the performance of resource-hungry programs

  • Tips and advice for programmers moving to Perl from other language environments

  • Focusing on the process of Perl programming and guidelines for identifying and correcting mistakes, Perl Debugged helps the developer to write better Perl programs immediately and become better programmers in general.


    Table of Contents

    1. Copyright
    2. Preface
    3. Introduction
      1. Reality
      2. Why Perl?
      3. Know the Environment
      4. Know the Language
      5. Online Documentation
      6. References
    4. The Zen of Perl Developing
      1. Attitudes
      2. Beliefs
      3. Behavior
      4. Improve Your Craft
      5. The Bottom Line
    5. Antibugging
      1. Beginning
      2. Writing Code
      3. Observation
      4. Documentation
      5. Developing
      6. Accident Prevention
      7. Tips for Reducing Complexity
    6. Perl Pitfalls
      1. Syntactical Sugaring
      2. The Hall of the Precedence
      3. Regular Expressions
      4. Miscellaneous
    7. Tracing Code
      1. Dumping Your Data
      2. Making it Optional
      3. Raise the Flag
      4. At Your Command
      5. Taking the Long Way Around
    8. Testing Perl Programs
      1. Inspection Testing
      2. Unit Testing
      3. System or Regression Testing
      4. Saturation Testing
      5. Acceptance Testing
      6. References
    9. The Perl Debugger
      1. Basic Operation
      2. Starting
      3. Getting Graphical
    10. Syntax Errors
      1. Typo Pathologies
      2. A Menagerie of Typos
    11. Run-time Exceptions
      1. Symbolic References
      2. Check That Return Code!
      3. Taking Exception to Yourself
      4. Playing Catch-Up
      5. Confession Is Good for the Soul
    12. Semantical Errors
      1. A Bit Illogical
      2. Reading Directories
      3. But What Did It Mean?
      4. printf Formats Don't Impose Context
      5. Conditional my
      6. Bringing Some Closure
    13. Resource Failure
      1. Optimize for People First, Resources Later
      2. Benchmark It!
      3. Making Things Better
    14. Perl as a Second Language
      1. Tips for Everyman
      2. Tips for the C Programmer
      3. Tips for the FORTRAN Programmer
      4. Tips for the Shell Programmer
      5. Tips for the C++ or Java Programmer
    15. Debugging CGI Programs
      1. CGI
      2. Web Servers
      3. 500—Server Error
      4. Basics
      5. Security
      6. Heading Off Errors
      7. cgi-test
      8. Eavesdropping
      9. CGI.pm
      10. Command Line Testing
      11. Dying Young
      12. Debugger Interaction
      13. ptkdb
    16. Conclusion
      1. Finis
      2. The End
      3. This Really Is the End
    17. Perl Debugger Commands
      1. General Syntax
      2. Commands
      3. Options
      4. Environment Variables
    18. Perls of Wisdom