Effective Perl Programming Ways to Write Better, More Idiomatic Perl
by Hall, Joseph N.; McAdams, Joshua A.; foy, brian dRent Book
New Book
We're Sorry
Sold Out
Used Book
We're Sorry
Sold Out
eBook
We're Sorry
Not Available
How Marketplace Works:
- This item is offered by an independent seller and not shipped from our warehouse
- Item details like edition and cover design may differ from our description; see seller's comments before ordering.
- Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
- Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
- Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.
Summary
Author Biography
Table of Contents
| Foreword | p. xi |
| Preface | p. xiii |
| Acknowledgments | p. xvii |
| About the Authors | p. xix |
| Introduction | p. 1 |
| The Basics of Perl | p. 9 |
| Find the documentation for Perl and its modules | p. 9 |
| Enable new Perl features when you need them | p. 12 |
| Enable strictures to promote better coding | p. 14 |
| Understand what sigils are telling you | p. 17 |
| Know your variable namespaces | p. 19 |
| Know the difference between string and numeric comparisons | p. 21 |
| Know which values are false and test them accordingly | p. 23 |
| Understand conversions between strings and numbers | p. 27 |
| Know the difference between lists and arrays | p. 31 |
| Don't assign undef when you want an empty array | p. 34 |
| Avoid a slice when you want an element | p. 37 |
| Understand context and how it affects operations | p. 41 |
| Use arrays or hashes to group data | p. 45 |
| Handle big numbers with bignum | p. 47 |
| Idiomatic Perl | p. 51 |
| Use $-for elegance and brevity | p. 53 |
| Know Perl's other default arguments | p. 56 |
| Know common shorthand and syntax quirks | p. 60 |
| Avoid excessive punctuation | p. 66 |
| Format lists for easy maintenance | p. 68 |
| Use foreach, map, and grep as appropriate | p. 70 |
| Know the different ways to quote strings | p. 73 |
| Learn the myriad ways of sorting | p. 77 |
| Make work easier with smart matching | p. 84 |
| Use given-when to make a switch statement | p. 86 |
| Use do {} to create inline subroutines | p. 90 |
| Use List: :Util and List: :MoreUtils for easy list manipulation | p. 92 |
| Use autodie to simplify error handling | p. 96 |
| Regular Expressions | p. 99 |
| Know the precedence of regular expression operators | p. 99 |
| Use regular expression captures | p. 103 |
| Use more precise whitespace character classes | p. 110 |
| Use named captures to label matches | p. 114 |
| Use noncapturing parentheses when you need only grouping | p. 116 |
| Watch out for the match variables | p. 117 |
| Avoid greed when parsimony is best | p. 119 |
| Use zero-width assertions to match positions in a string | p. 121 |
| Avoid using regular expressions for simple string operations | p. 125 |
| Make regular expressions readable | p. 129 |
| Avoid unnecessary backtracking | p. 132 |
| Compile regexes only once | p. 137 |
| Pre-compile regular expressions | p. 138 |
| Benchmark your regular expressions | p. 139 |
| Don't reinvent the regex | p. 142 |
| Subroutines | p. 145 |
| Understand the difference between my and local | p. 145 |
| Avoid using @-directly unless you have to | p. 154 |
| Use wantarray to write subroutines returning lists | p. 157 |
| Pass references instead of copies | p. 160 |
| Use hashes to pass named parameters | p. 164 |
| Use prototypes to get special argument parsing | p. 168 |
| Create closures to lock in data | p. 171 |
| Create new subroutines with subroutines | p. 176 |
| Files and Filehandles | p. 179 |
| Don't ignore the file test operators | p. 179 |
| Always use the three-argument open | p. 182 |
| Consider different ways of reading from a stream | p. 183 |
| Open filehandles to and from strings | p. 186 |
| Make flexible output | p. 189 |
| Use File: :Spec or Path: :Class to work with paths | p. 192 |
| Leave most of the data on disk to save memory | p. 195 |
| References | p. 201 |
| Understand references and reference syntax | p. 201 |
| Compare reference types to prototypes | p. 209 |
| Create arrays of arrays with references | p. 211 |
| Don't confuse anonymous arrays with list literals | p. 214 |
| Build C-style structs with anonymous hashes | p. 216 |
| Be careful with circular data structures | p. 218 |
| Use map and grep to manipulate complex data structures | p. 221 |
| CPAN | p. 227 |
| Install CPAN modules without admin privileges | p. 228 |
| Carry a CPAN with you | p. 231 |
| Mitigate the risk of public code | p. 235 |
| Research modules before you install them | p. 239 |
| Ensure that Perl can find your modules | p. 242 |
| Contribute to CPAN | p. 246 |
| Know the commonly used modules | p. 250 |
| Unicode | p. 253 |
| Use Unicode in your source code | p. 254 |
| Tell Perl which encoding to use | p. 257 |
| Specify Unicode characters by code point or name | p. 258 |
| Convert octet strings to character strings | p. 261 |
| Match Unicode characters and properties | p. 265 |
| Work with graphemes instead of characters | p. 269 |
| Be careful with Unicode in your databases | p. 272 |
| Distributions | p. 275 |
| Use Module: :Build as your distribution builder | p. 275 |
| Don't start distributions by hand | p. 278 |
| Choose a good module name | p. 283 |
| Embed your documentation with Pod | p. 287 |
| Limit your distributions to the right platforms | p. 292 |
| Check your Pod | p. 295 |
| Inline code for other languages | p. 298 |
| Use XS for low-level interfaces and speed | p. 301 |
| Testing | p. 307 |
| Use prove for flexible test runs | p. 308 |
| Run tests only when they make sense | p. 311 |
| Use dependency injection to avoid special test logic | p. 314 |
| Don't require more than you need to use in your methods | p. 317 |
| Write programs as modulinos for easy testing | p. 320 |
| Mock objects and interfaces to focus tests | p. 324 |
| Use SQLite to create test databases | p. 330 |
| UseTest: :Class for more structured testing | p. 332 |
| Start testing at the beginning of your project | p. 335 |
| Measure your test coverage | p. 342 |
| Use CPAN Testers as your QA team | p. 346 |
| Set up a continuous build system | p. 348 |
| Warnings | p. 357 |
| Enable warnings to let Perl spot suspicious code | p. 358 |
| Use lexical warnings to selectively turn on or off complaints | p. 361 |
| Use die to generate exceptions | p. 364 |
| Use Carp to get stack traces | p. 366 |
| Handle exceptions properly | p. 370 |
| Track dangerous data with taint checking | p. 372 |
| Start with taint warnings for legacy code | p. 375 |
| Databases | p. 377 |
| Prepare your SQL statements to reuse work and save time | p. 377 |
| Use SQL placeholders for automatic value quoting | p. 382 |
| Bind return columns for faster access to data | p. 384 |
| Reuse database connections | p. 386 |
| Miscellany | p. 391 |
| Compile and install your own Perls | p. 391 |
| Use Perl: :Tidy to beautify code | p. 394 |
| Use Perl Critic | p. 398 |
| Use Log: :Log4perl to record your program's state | p. 403 |
| Know when arrays are modified in a loop | p. 410 |
| Don't use regular expressions for com ma-separated values | p. 412 |
| Use unpack to process columnar data | p. 414 |
| Use pack and unpack for data munging | p. 416 |
| Access the symbol table with typeglobs | p. 423 |
| Initialize with BEGIN; finish with END | p. 425 |
| Use Perl one-liners to create mini programs | p. 428 |
| Perl Resources | p. 435 |
| Map from First to Second Edition | p. 439 |
| Books | p. 435 |
| Websites | p. 436 |
| Blogs and Podcasts | p. 437 |
| Getting Help | p. 437 |
| Index | p. 445 |
| Table of Contents provided by Ingram. All Rights Reserved. |
An electronic version of this book is available through VitalSource.
This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.
By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.
Digital License
You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.
More details can be found here.
A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.
Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.
Please view the compatibility matrix prior to purchase.
