Perl最佳实践全览:英文版权威指南

需积分: 31 0 下载量 55 浏览量 更新于2024-07-22 收藏 7.68MB PDF 举报
《Perl 最佳实践》(Perl Best Practices.pdf)是由Damian Conway编著的一本权威指南,专为Perl编程语言爱好者和专业开发者提供深入而实用的最佳实践。这本书在2005年由O'Reilly Media出版,非扫描版并提供了英文版本,方便全球读者学习。它不仅包含了Perl语言的基础知识,更着重于提升代码质量和开发效率,适合各个层次的Perl开发者。 Perl,作为一种动态、通用的脚本语言,因其灵活性和强大功能深受程序员喜爱。本书的核心内容围绕以下几个方面: 1. **编程原则**:作者强调了Perl编程中的最佳实践,包括但不限于清晰的代码结构、模块化设计、避免全局变量的滥用以及对错误处理的重视。 2. **性能优化**:书中深入探讨了如何通过合理地利用Perl特性,如正则表达式、元编程和高效的数据结构来提高程序运行速度。 3. **代码可读性和维护性**:作者倡导编写易于理解、一致和注释丰富的代码,以降低未来维护成本,并提倡使用标准命名约定和文档编写规范。 4. **模块与包管理**:Perl有许多强大的模块生态系统,书中会介绍如何选择、使用和创建模块,以及如何有效地组织和分发自己的代码。 5. **设计模式与架构**:针对大型项目,书中讨论了如何应用设计模式,如何构建模块化的、可扩展的系统架构。 6. **安全与安全实践**:Perl虽然强大,但也可能带来潜在的安全隐患。书中会指导开发者如何避免常见的安全问题,如SQL注入、跨站脚本攻击等。 7. **版本控制与协作**:给出了使用Perl项目的版本控制系统(如Git)和团队协作工具的建议,帮助开发者更好地管理和分享代码。 8. **实用技巧与工具**:书中还包含了众多实用的Perl命令行技巧和工具,如Perl测试框架Test::More,以及自动化工具和配置管理工具。 《Perl 最佳实践》是一本值得所有Perl开发者研读的宝典,无论是初学者还是经验丰富的开发者,都能从中收获关于提高编程效率、写出高质量代码的宝贵经验和教训。通过遵循书中提供的最佳实践,开发者可以避免常见陷阱,提升代码质量,进而更好地适应不断发展的IT行业需求。
2010-01-12 上传
Many programmers code by instinct, relying on convenient habits or a "style" they picked up early on. They aren't conscious of all the choices they make, like how they format their source, the names they use for variables, or the kinds of loops they use. They're focused entirely on problems they're solving, solutions they're creating, and algorithms they're implementing. So they write code in the way that seems natural, that happens intuitively, and that feels good. But if you're serious about your profession, intuition isn't enough. Perl Best Practices author Damian Conway explains that rules, conventions, standards, and practices not only help programmers communicate and coordinate with one another, they also provide a reliable framework for thinking about problems, and a common language for expressing solutions. This is especially critical in Perl, because the language is designed to offer many ways to accomplish the same task, and consequently it supports many incompatible dialects. With a good dose of Aussie humor, Dr. Conway (familiar to many in the Perl community) offers 256 guidelines on the art of coding to help you write better Perl code--in fact, the best Perl code you possibly can. The guidelines cover code layout, naming conventions, choice of data and control structures, program decomposition, interface design and implementation, modularity, object orientation, error handling, testing, and debugging. They're designed to work together to produce code that is clear, robust, efficient, maintainable, and concise, but Dr. Conway doesn't pretend that this is the one true universal and unequivocal set of best practices. Instead, Perl Best Practices offers coherent and widely applicable suggestions based on real-world experience of how code is actually written, rather than on someone's ivory-tower theories on how software ought to be created. Most of all, Perl Best Practices offers guidelines that actually work, and that many developers around the world are already using. Much like Perl itself, these guidelines are about helping you to get your job done, without getting in the way. Praise for Perl Best Practices from Perl community members: "As a manager of a large Perl project, I'd ensure that every member of my team has a copy of Perl Best Practices on their desk, and use it as the basis for an in-house style guide." -- Randal Schwartz "There are no more excuses for writing bad Perl programs. All levels of Perl programmer will be more productive after reading this book." -- Peter Scott "Perl Best Practices will be the next big important book in the evolution of Perl. The ideas and practices Damian lays down will help bring Perl out from under the embarrassing heading of "scripting languages". Many of us have known Perl is a real programming language, worthy of all the tasks normally delegated to Java and C++. With Perl Best Practices, Damian shows specifically how and why, so everyone else can see, too." -- Andy Lester "Damian's done what many thought impossible: show how to build large, maintainable Perl applications, while still letting Perl be the powerful, expressive language that programmers have loved for years." -- Bill Odom "Finally, a means to bring lasting order to the process and product of real Perl development teams." -- Andrew Sundstrom"Perl Best Practices provides a valuable education in how to write robust, maintainable Perl, and is a definitive citation source when coaching other programmers." -- Bennett Todd "I've been teaching Perl for years, and find the same question keeps being asked: Where can I find a reference for writing reusable, maintainable Perl code? Finally I have a decent answer." -- Paul Fenwick "At last a well researched, well thought-out, comprehensive guide to Perl style. Instead of each of us developing our own, we can learn good practices from one of Perl's most prolific and experienced authors. I recommend this book to anyone who prefers getting on with the job rather than going back and fixing errors caused by syntax and poor style issues." -- Jacinta Richardson "If you care about programming in any language read this book. Even if you don't intend to follow all of the practices, thinking through your style will improve it." -- Steven Lembark "The Perl community's best author is back with another outstanding book. There has never been a comprehensive reference on high quality Perl coding and style until Perl Best Practices. This book fills a large gap in every Perl bookshelf." -- Uri Guttman