Perl Medic: Transforming Legacy Code

Book description

Bring new power, performance, and scalability to your existing Perl code!

  • Cure whatever ails your Perl code!

  • Maintain, optimize, and scale any Perl software... whether you wrote it or not

  • Perl software engineering best practices for enterprise environments

  • Includes case studies and code in a fun-to-read format

  • Today's Perl developers spend 60-80% of their time working with existing Perl code. Now, there's a start-to-finish guide to understanding that code, maintaining it, updating it, and refactoring it for maximum performance and reliability. Peter J. Scott, lead author of Perl Debugged, has written the first systematic guide to Perl software engineering. Through extensive examples, he shows how to bring powerful discipline, consistency, and structure to any Perl program-new or old. You'll discover how to:

  • Scale existing Perl code to serve larger network, Web, enterprise, or e-commerce applications

  • Rewrite, restructure, and upgrade any Perl program for improved performance

  • Bring standards and best practices to your entire library of Perl software

  • Organize Perl code into modules and components that are easier to reuse

  • Upgrade code written for earlier versions of Perl

  • Write and execute better tests for your software...or anyone else's

  • Use Perl in team-based, methodology-driven environments

  • Document your Perl code more effectively and efficiently

  • If you've ever inherited Perl code that's hard to maintain, if you write Perl code others will read, if you want to write code that'll be easier for you to maintain, the book that comes to your rescue is Perl Medic.

    If you code in Perl, you need to read this book.–Adam Turoff, Technical Editor, The Perl Review.

    Perl Medic is more than a book. It is a well-crafted strategy for approaching, updating, and furthering the cause of inherited Perl programs.–Allen Wyke, co-author of several computer books including JavaScript Unleashed and Pure JavaScript.

    Scott's explanations of complex material are smooth and deceptively simple. He knows his subject matter and his craft-he makes it look easy. Scott remains relentless practical-even the 'Analysis' chapter is filled with code and tests to run.–Dan Livingston, author of several computer books including Advanced Flash 5: Actionscript in Action



    Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Dedication Page
    5. Table of Contents
    6. Preface
      1. Perl or perl?
      2. Obtaining Perl
      3. Historical Perl
      4. Who This Book Is For
      5. Typographical Conventions
      6. For Further Reference
      7. Perl Versions
      8. Perl 6
      9. Acknowledgments
    7. Chapter 1. Introduction (First Response)
      1. 1.1. First Things First
      2. 1.2. Reasons for Inheritance
      3. 1.3. What Next?
      4. 1.4. Observe the Program in Its Natural Habitat
      5. 1.5. Get Personal
      6. 1.6. Strictness
      7. 1.7. Warnings
    8. Chapter 2. Surveying the Scene
      1. 2.1. Versions
      2. 2.2. Part or Whole?
      3. 2.3. Find the Dependencies
    9. Chapter 3. Test Now, Test Forever (Diagnosis)
      1. 3.1. Testing Your Patience
      2. 3.2. Extreme Testing
      3. 3.3. An Example Using Test:: Modules
      4. 3.4. Testing Legacy Code
      5. 3.5. A Final Encouragement
    10. Chapter 4. Rewriting (Transplants)
      1. 4.1. Strategizing
      2. 4.2. Why Are You Doing This?
      3. 4.3. Style
      4. 4.4. Comments
      5. 4.5. Restyling
      6. 4.6. Variable Renaming
      7. 4.7. Editing
      8. 4.8. Line Editing
      9. 4.9. Antipatterns
      10. 4.10. Evolution
    11. Chapter 5. The Disciplined Perl Program
      1. 5.1. Package Variables vs. Lexical Variables
      2. 5.2. Warnings and Strictness
      3. 5.3. use strict in Detail
      4. 5.4. use warnings in Detail
      5. 5.5. Selective Disabling
      6. 5.6. Caveat Programmer
      7. 5.7. Perl Poetry
    12. Chapter 6. Restructuring (The Operating Table)
      1. 6.1. Keep It Brief
      2. 6.2. Cargo Cult Perl
      3. 6.3. Escaping the Global Variable Trap
      4. 6.4. Debugging Strategies
    13. Chapter 7. Upgrading (Plastic Surgery)
      1. 7.1. Strategies
      2. 7.2. Perl 4
      3. 7.3. Perl 5.000
      4. 7.4. Perl 5.001
      5. 7.5. Perl 5.002
      6. 7.6. Perl 5.003
      7. 7.7. Perl 5.004
      8. 7.8. Perl 5.005
      9. 7.9. Perl 5.6.0
      10. 7.10. Perl 5.6.1
      11. 7.11. Perl 5.8.0
      12. 7.12. Perl 5.8.1
      13. 7.13. Perl 5.8.2
      14. 7.14. Perl 5.8.3
    14. Chapter 8. Using Modules (Genetic Enhancement)
      1. 8.1. The Case for CPAN
      2. 8.2. Using CPAN
      3. 8.3. Improving Code with Modules
      4. 8.4. Custom Perls
    15. Chapter 9. Analysis (Forensic Pathology)
      1. 9.1. Static Analysis
      2. 9.2. Eliminating Superfluous Code
      3. 9.3. Finding Inefficient Code
      4. 9.4. Debugging
    16. Chapter 10. Increasing Maintainability (Prophylaxis)
      1. 10.1. Making It Robust
      2. 10.2. Advanced Brevity
      3. 10.3. Documentation
      4. 10.4. Custom Warnings
      5. 10.5. Version Control System Integration
    17. Chapter 11. A Case Study
      1. 11.1. The Setup
      2. 11.2. Triage
      3. 11.3. Desperately Seeking Sanity
      4. 11.4. Coming into the 21st Century
      5. 11.5. Incorporating Modules Effectively, Part 1
      6. 11.6. Incorporating Modules Effectively, Part 2
      7. 11.7. Making It Mature, Part 1
      8. 11.8. Making It Mature, Part 2
      9. 11.9. Making It Mature, Part 3
      10. 11.10. Advanced Modification
    18. Chapter 12. Conclusion (Prognosis)
      1. 12.1. In Conclusion
      2. 12.2. Perl People
      3. 12.3. A Final Thought
    19. Appendix: Source Code
      1. Tie::Array::Bounded
      2. Benchmark::TimeTick
      3. smallprofpp
    20. Bibliography
    21. Index
    22. About the Author

    Product information

    • Title: Perl Medic: Transforming Legacy Code
    • Author(s):
    • Release date: March 2004
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 0201795264