Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Perl Hacks
SPECIAL OFFER: Upgrade this ebook with O’Reilly
A Note Regarding Supplemental Files
Credits
About the Authors
About the Contributors
Acknowledgments
chromatic
Damian Conway
Curtis "Ovid" Poe
Technical Reviewers
Preface
Why Perl Hacks?
How To Use This Book
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
Safari Enabled
We'd Like to Hear from You
1. Productivity Hacks
Hack #1. Add CPAN Shortcuts to Firefox
Search for a Module
Read Module Documentation
Find Module Comments
Hacking the Hack
Hack #2. Put Perldoc to Work
Find Operator Documentation
Answer a FAQ
Webify It
Find that Module!
Browse the Code
Hack #3. Browse Perl Docs Online
The Hack
Running the Hack
Hacking the Hack
Hack #4. Make the Most of Shell Aliases
Configuring Your Shell
Useful Shell Aliases
Juggle multiple Perl versions
Juggle multiple module versions
Don't forget multipart commands
Remember configuration options
Find a module's version
Change Unix paths to Windows paths and back
Hack #5. Autocomplete Perl Identifiers in Vim
The Hack
Finding Identifiers Automatically
Hacking the Hack
Hack #6. Use the Best Emacs Mode for Perl
The Hack
Put Perldoc at your fingertips
Use a special mode just for Pod
Hack #7. Enforce Local Style
The Hack
From the command line
Within Vim
Within Emacs
Hack #8. Don't Save Bad Perl
The Hack
Running the Hack
Hacking the Hack
Hack #9. Automate Checkin Code Reviews
The Hack
Hacking the Hack
Hack #10. Run Tests from Within Vim
The Hack
Binding keys
Seeing failures
Managing paths
Hack #11. Run Perl from Emacs
The Hack
2. User Interaction
Hack #12. Use $EDITOR As Your UI
The Hack
Running the Hack
Hacking the Hack
Hack #13. Interact Correctly on the Command Line
The Hack
The Hack
Hack #14. Simplify Your Terminal Interactions
Train -req
Yea or Nay
At the Touch of a Button
Engage Cloaking Device
What's On the Menu?
Hack #15. Alert Your Mac
The Hack
Running the Hack
Hacking the Hack
Hack #16. Interactive Graphical Apps
Blitting with SDL Perl
Animating with SDL Perl
A Working Animation
Hack #17. Collect Configuration Information
The Hack
Using the Hack
Hack #18. Rewrite the Web
The Hack
Running the Hack
Hacking the Hack
3. Data Munging
Hack #19. Treat a File As an Array
The Hack
Running the Hack
Hack #20. Read Files Backwards
The Hack
Running the Hack
Hacking the Hack
Hack #21. Use Any Spreadsheet As a Data Source
Accessing Cell Data
Do I need Spreadsheet::Read for that?
Accessing a data column
Accessing a row of data
Using programmer-style indexing
Showing all data in a spreadsheet
How It Works
Hacking the Hack
Hack #22. Factor Out Database Code
The Hack
Running the Hack
Hacking the Hack
Hack #23. Build a SQL Library
The Hack
Running the Hack
Hacking the Hack
Hack #24. Query Databases Dynamically Without SQL
The Hack
Hacking the Hack
Hack #25. Bind Database Columns
The Hack
Running the Hack
Hack #26. Iterate and Generate Expensive Data
The Hack
Running the Hack
Hacking the Hack
Hack #27. Pull Multiple Values from an Iterator
Better Context than wantarray( )
The Code
Hacking the Hack
4. Working with Modules
Hack #28. Shorten Long Class Names
The Hack
Resolve conflicts
Importing with aliased
Hack #29. Manage Module Paths
Within Your Program
From the Command Line
With an Environment Variable
When Recompiling Perl
Hack #30. Reload Modified Modules
The Hack
Running the Hack
Hacking the Hack
Hack #31. Create Personal Module Bundles
The Hack
Running the Hack
Hacking the Hack
Hack #32. Manage Module Installations
The Hack
Running the Hack
Hacking the Hack
Hack #33. Presolve Module Paths
The Hack
Running the Hack
Hacking the Hack
Hack #34. Create a Standard Module Toolkit
A Mess of Modules
The Hack
Hacking the Hack
Hack #35. Write Demos from Tutorials
The Hack
Running the Hack
Inside the Hack
Hacking the Hack
Hack #36. Replace Bad Code from the Outside
The Hack
Hacking the Hack
Hack #37. Drink to the CPAN
Running the Hack
Hacking the Hack
Hack #38. Improve Exceptional Conditions
The Hack
Running the Hack
Hacking the Hack
Hack #39. Search CPAN Modules Locally
The Hack
Hacking the Hack
Hack #40. Package Standalone Perl Applications
The Hack
Running the Hack
Hacking the Hack
Hack #41. Create Your Own Lexical Warnings
The Hack
Running the Hack
Hacking the Hack
Hack #42. Find and Report Module Bugs
Write a Test
Submitting a bug report
Hacking the Hack
5. Object Hacks
Hack #43. Turn Your Objects Inside Out
The Hack
Running the Hack
Hacking the Hack
Hack #44. Serialize Objects (Mostly) for Free
The Hack
Hack #45. Add Information with Attributes
The Hack
Running the Hack
Hacking the Hack
Hack #46. Make Methods Really Private
The Hack
Running the Hack
Inside the hack
Hacking the Hack
Hack #47. Autodeclare Method Arguments
The Hack
Running the Hack
Hacking the Hack
Hack #48. Control Access to Remote Objects
The Hack
Hacking the Hack
Hack #49. Make Your Objects Truly Polymorphic
The Hack
Running the Hack
Hacking the Hack
Hack #50. Autogenerate Your Accessors
The Hack
Class::MethodMaker
Class::BuildMethods
Running the Hack
6. Debugging
Hack #51. Find Compilation Errors Fast
The Hack
Binary searching for bugs
Hacking the Hack
Hack #52. Make Invisible Characters Apparent
Bracket Your Variables
Bracket Interpolated Lists
Serialize Your Data
Hack #53. Debug with Test Cases
The Hack
Writing test code
From test code to test cases
Hacking the Hack
Hack #54. Debug with Comments
The Hack
Displaying variables
Making Assertions
Configuring smartness levels
Hack #55. Show Source Code on Errors
The Hack
Running the Hack
Hacking the Hack
Hack #56. Deparse Anonymous Functions
The Hack
Running the Hack
Hacking the Hack
Hack #57. Name Your Anonymous Subroutines
The Hack
Hacking the Hack
Hack #58. Find a Subroutine's Source
The Hack
Running the Hack
Hack #59. Customize the Debugger
The Hack
Overriding a debugger command
Running the Hack
Hacking the Hack
7. Developer Tricks
Hack #60. Rebuild Your Distributions
The Hack
Running the Hack
Hacking the Hack
Hack #61. Test with Specifications
The Hack
Running the Hack
Refining your claims
Interpreting test output
Taking advantage of specification-based testing
Hack #62. Segregate Developer and User Tests
The Hack
Running the Hack
Hacking the Hack
Hack #63. Run Tests Automatically
The Hack
Running the Hack
Hacking the Hack
Hack #64. See Test Failure Diagnostics — in Color!
The Hack
Hacking the Hack
Hack #65. Test Live Code
The Hack
Hacking the Hack
Hack #66. Cheat on Benchmarks
Hack #67. Build Your Own Perl
The Hack
Running the Hack
Hacking the Hack
Hack #68. Run Test Suites Persistently
The Hack
Creating a wrapper around prove
Running the Hack
Hacking the Hack
Hack #69. Simulate Hostile Environments in Your Tests
The Hack
Simulating old versions of modules
Simulating missing modules
Running multiple scenarios
Hacking the Hack
8. Know Thy Code
Hack #70. Understand What Happens When
The Hack
Compilation
Initialization
Runtime
Cleanup
Hack #71. Inspect Your Data Structures
Dumping References Outside the Debugger
Printing to a File
Output in CGI or mod_perl Programs
Hack #72. Find Functions Safely
The Hack
Get cozy with can( )
Find functions, not methods!
Hack #73. Know What's Core and When
The Hack
Checking by version
Hack #74. Trace All Used Modules
The Hack
Running the Hack
Hacking the Hack
Hack #75. Find All Symbols in a Package
The Hack
How does it work?
Running the Hack
Hack #76. Peek Inside Closures
The Hack
Running the Hack
Hacking the Hack
Hack #77. Find All Global Variables
The Hack
Running the Hack
Hacking the Hack
Hack #78. Introspect Your Subroutines
The Hack
Running the Hack
Hacking the Hack
Hack #79. Find Imported Functions
The Hack
Running the Hack
Hacking the Hack
Hack #80. Profile Your Program Size
The Hack
Running the Hack
Hacking the Hack
Hack #81. Reuse Perl Processes
The Hack
Running the Hack
Hacking the Hack
Hack #82. Trace Your Ops
The Hack
Running the Hack
Hacking the Hack
Hack #83. Write Your Own Warnings
The Hack
Running the Hack
Hacking the Hack
9. Expand Your Perl Foo
Hack #84. Double Your Data with Dualvars
The Hack
Running the Hack
Hacking the Hack
Hack #85. Replace Soft References with Real Ones
The Hack
Hacking the Hack
Hack #86. Optimize Away the Annoying Stuff
The Hack
Hacking the Hack
Hack #87. Lock Down Your Hashes
The Hack
Running the Hack
Hack #88. Clean Up at the End of a Scope
The Hack
Hacking the Hack
Hack #89. Invoke Functions in Odd Ways
The Hack
Make a Bareword invoke a function
Tie a scalar variable to a function
Tie an array variable to a function
Tie a hash variable to a function
Add a function-calling layer to filehandles
Hack #90. Glob Those Sequences
The Hack
Running the Hack
Hacking the Hack
Hack #91. Write Less Error-Checking Code
The Hack
Hacking the Hack
Hack #92. Return Smarter Values
Fine Distinctions
Name that Return Value
Out, Out, Damn Commas!
Hack #93. Return Active Values
The Hack
Running the Hack
Hacking the Hack
Hack #94. Add Your Own Perl Syntax
The Hack
Hack #95. Modify Semantics with a Source Filter
The Hack
Hacking the Hack
Hack #96. Use Shared Libraries Without XS
The Hack
Running the Hack
Hacking the Hack
Hack #97. Run Two Services on a Single TCP Port
The Hack
Running the Hack
Hacking the Hack
Hack #98. Improve Your Dispatch Tables
The hack
Running the Code
Hack #99. Track Your Approximations
Interval interlude
Teaching Perl to think in intervals
Hack #100. Overload Your Operators
The Hack
Saying what you mean
Hack #101. Learn from Obfuscations
Index
About the Authors
Colophon
SPECIAL OFFER: Upgrade this ebook with O’Reilly
← Prev
Back
Next →
← Prev
Back
Next →