Computer Science & Perl Programming. Best of The Perl Journal - Helion
ISBN: 978-14-493-7134-0
stron: 762, Format: ebook
Data wydania: 2002-11-04
Księgarnia: Helion
Cena książki: 152,15 zł (poprzednio: 176,92 zł)
Oszczędzasz: 14% (-24,77 zł)
In its first five years of existence, The Perl Journal ran 247 articles by over 120 authors. Every serious Perl programmer subscribed to it, and every notable Perl guru jumped at the opportunity to write for it. TPJ explained critical topics such as regular expressions, databases, and object-oriented programming, and demonstrated Perl's utility for fields as diverse as astronomy, biology, economics, AI, and games. The magazine gave birth to both the Obfuscated Perl Contest and the Perl Poetry contest, and remains a proud and timeless achievement of Perl during one of its most exciting periods of development.Computer Science and Perl Programming is the first volume of The Best of the Perl Journal, compiled and re-edited by the original editor and publisher of The Perl Journal, Jon Orwant. In this series, we've taken the very best (and still relevant) articles published in TPJ over its 5 years of publication and immortalized them into three volumes. This volume has 70 articles devoted to hard-core computer science, advanced programming techniques, and the underlying mechanics of Perl.Here's a sample of what you'll find inside:
- Jeffrey Friedl on Understanding Regexes
- Mark Jason Dominus on optimizing your Perl programs with Memoization
- Damian Conway on Parsing
- Tim Meadowcroft on integrating Perl with Microsoft Office
- Larry Wall on the culture of Perl
Osoby które kupowały "Computer Science & Perl Programming. Best of The Perl Journal", wybierały także:
- Perl. Mistrzostwo w programowaniu 44,00 zł, (22,00 zł -50%)
- Wielkie umysły programowania. Jak myślą i pracują twórcy najważniejszych języków 79,00 zł, (47,40 zł -40%)
- Learning Perl. Making Easy Things Easy and Hard Things Possible. 7th Edition 169,00 zł, (118,30 zł -30%)
- 100 sposobów na Perl 39,00 zł, (29,25 zł -25%)
- Mastering Perl. 2nd Edition 177,35 zł, (143,65 zł -19%)
Spis treści
Computer Science & Perl Programming. Best of The Perl Journal eBook -- spis treści
- Computer Science & Perl Programming
- A Note Regarding Supplemental Files
- Foreword
- Preface
- Finding Perl Resources
- Conventions Used in This Book
- Comments and Questions
- Acknowledgments
- 1. Introduction
- History of TPJ
- Computer Science and Perl Programming
- I. Beginner Concepts
- 2. All About Arrays
- Basics
- Positions
- Position Versus Count
- Foreach Loops
- The Reverse and Sort Functions
- Slices
- Adding and Deleting Values
- Lists to Strings and Back Again
- Putting It All Together
- 3. Perfect Programming
- Warnings with -w
- The strict Pragma
- Tainting and Safe
- Checking Return Values
- Planning for Failure
- The Perl Debugger
- The Perl Profiler
- Stack Traces
- 4. Precedence
- What Is Precedence?
- Rules and More Rules
- An Explosion of Rules
- Precedence Traps and Surprises
- List Operators and Unary Operators
- Complete Rules of Precedence
- How to Remember All the Rules
- Quiz
- Answers
- 5. The Birth of a One-Liner
- 6. Comparators, Sorting, and Hashes
- Sorting
- The Simplest Way to Sort
- Tinkering with the Sort
- Sorting Hashes
- Sorting by Key
- Sorting a Hash by Value
- Sorting a Hash by Key and Value
- Efficient Sorting
- Further Reading
- Sorting
- 7. What Is Truth?
- The undef Function
- Back to Truth
- Truth in Context
- Applications
- Conclusion
- 8. Using Object-Oriented Modules
- Modules and Their Functional Interfaces
- Modules with Object-Oriented Interfaces
- Class Methods
- Object Methods
- What Can You Do with Objects?
- Whats in an Object?
- What Is an Object Value?
- So Why Do Some Modules Use Objects?
- 9. Unreal Numbers
- A Surprising Program
- The Right Way
- 10. CryptoContext
- Context
- Prototypes
- Subroutine Calls
- Putting Them All Together
- Conclusion
- Context Is Subtle
- Prototypes Are a Mixed Blessing
- 11. References
- Who Needs Complicated Data Structures?
- The Solution
- Making References
- Using References
- An Example
- Solution
- The Rest
- In Summary
- 12. Perl Heresies
- Dont Use -w
- Dont Use Regular Expressions Just Because Theyre Cool
- Dont Always Use Modules
- Partial Solutions Are Okay
- 2. All About Arrays
- II. Regular Expressions
- 13. Understanding Regular Expressions, Part I
- The Story of Fred
- Reality Check
- Regular Expression Background
- DFA Versus NFA
- NFA Versus NFA, DFA Versus DFA
- Perl Regex Engine Basics
- A Sample Regex
- The Longest Match Wins and Other Myths
- The First Real Rule of Regexes
- A Single Match Attempt
- Multiple Paths
- Backtracking
- Options, Options, Options
- Alternation
- Character Classes
- How the Path Is Chosen
- Thats Pretty Much It
- 14. Understanding Regular Expressions, Part II
- Knowing Versus Knowing on Paper
- Will They Work at All?
- How Do They Differ?
- Which Is Best?
- Efficiency
- Greediness
- Logical or Versus Regex or
- Benchmarking
- Conclusion
- Knowing Versus Knowing on Paper
- 15. Understanding Regular Expressions, Part III
- 16. Nibbling Strings
- The Problem
- Going on a Diet
- 17. How Regexes Work
- Machines
- Blank Arrows
- Rules Again
- How to Turn a Regex into a Penny Machine
- What Do You Mean, Done?
- The Regex Module
- Implications for Perl
- What About Backreferences?
- Internals of Regex.pm
- Lies
- Other Directions
- Bibliography
- 13. Understanding Regular Expressions, Part I
- III. Computer Science
- 18. Infinite Lists
- Hammings Problem
- Streams
- Hammings Problem Revisited
- Dataflow Programming
- Other Directions
- References
- 19. Compression
- Morse Code
- Ambiguous Codes
- Huffman Coding
- The Code
- The Rub
- Another Rub
- Other Methods
- Other Directions
- Bibliography
- 20. Memoization
- Recursive Functions
- The Memoize Module
- Module Internals
- Some Other Applications of Memoization
- Persistent Cache
- Profiling Execution Speed
- The Orcish Maneuver
- Dynamic Programming
- When Memoizing Doesnt Work
- Bibliography
- 21. Parsing
- A Sample Parse
- Formal Grammars
- The Different Types of Parsers
- Bottom-Up Parsers
- Top-Down Parsers
- The Descent of RecDescent
- Building a Parser with Parse::RecDescent
- How Parse::RecDescent Works
- Handling Items
- Handling Repeated Items
- No Lexer
- Error Handling
- An In-Depth Example
- Freeform Grammar
- Advanced Features of Parse::RecDescent
- Automated Error Reporting
- Integrated Tracing Facilities
- Position Information Within Actions
- Parse Tree Pruning
- Deferred Actions
- Extensible Grammars
- Practical Applications of Parsing
- Limitations of Parse::Recdescent
- No Left-Recursion
- Coming Attractions
- More Information
- Acknowledgments
- 22. Trees and Game Trees
- What Is a Tree?
- Formal Definition
- Markup Language Trees
- Building Your Own Trees
- An Implementation: Game Trees for Alak
- Digression: Links to Parents
- Recursively Printing the Tree
- Growing the Tree
- References
- 23. B_Trees
- A Review of Binary Trees
- The Problem with Binary Trees
- B-Trees Are Always Balanced
- A Guided Tour of the Program
- Moving Down
- Moving Up
- Details
- Other Directions
- Bibliography
- 24. Making Life and Death Decisions with Perl
- Probability Theory
- Whoa!
- Perl
- Last Words
- 25. Information Retrieval
- Text Searches on Manual Pages
- The Implementation
- Relevance Feedback
- Advanced Search Operators
- Conclusion
- References
- 26. Randomness
- Congruential Generators
- Choosing the Seed
- LFSRs
- References
- 27. Random Number Generators and XS
- Random Versus Pseudorandom Numbers
- Linear Congruential Generators Revisited
- Its Not That Bad
- Its Not Good, Either
- A Better Generator for Perl
- Bridging C and Perl with XS
- XS Overview
- Types and the Typemap
- Acknowledgments
- References
- 18. Infinite Lists
- IV. Programming Techniques
- 28. Suffering from Buffering
- What Is Buffering?
- Surprise!
- Disabling Inappropriate Buffering
- Hot and Not Hot
- Other Perils of Buffering
- My Output Is Coming Out in the Wrong Order!
- My Web Server Says I Didnt Send the Right Headers, but Im Sure I Did!
- Im Trying to Send Data over the Network, but Nothing Is Sent!
- When My Program Terminates Abnormally, the Output Is Incomplete!
- Flushing on Command
- Other Directions
- Summary
- 29. Scoping
- Package Variables
- The Current Package
- Package Variable Trivia
- Lexical Variables
- local and my
- What Good Is local?
- When to Use my and When to Use local
- Other Properties of my Variables
- my Variable Trivia
- Declarations
- use vars and our
- Summary
- 30. Seven Useful Uses of local
- 1. Special Variables
- 2. Localized Filehandles
- Localized Filehandles Revisited
- Marginal Uses of Localized Filehandles
- Dirhandles
- 3. The First Class Filehandle Trick
- 4. Aliases
- 5. Dynamic Scope
- 6. Dynamic Scope Revisited
- Marginal Uses of Dynamic Scoping
- 7. Perl 4 and Other Relics
- Summary
- 31. Parsing Command-Line Options
- Option Parsing Conventions
- The Simplest Way
- The Easy Way
- The Advanced Way
- Option Words
- Using and Bundling Single-Letter Options
- Advanced Destinations
- Other Configurations
- Help Messages
- Other Option Handling Modules
- 32. Building a Better Hash with tie
- Introduction
- The Problem
- Discussion
- Attempted Solutions
- Check for Built-In Support
- See If a Solution Already Exists
- A Working Data Structure
- Implementation
- Implementing a Tied Hash
- Using a Tied Hash
- Testing
- Optimizations
- Time
- Space
- Making It a Module
- Summing Up
- References
- 33. Source Filters
- Concepts
- Using Filters
- Writing a Source Filter
- Writing a Source Filter in C
- Creating a Source Filter as a Separate Executable
- Writing a Source Filter in Perl
- The Debug Filter
- Conclusion
- 34. Overloading
- Defining Your Own Types
- Adding Methods to the Date Class
- A Minor Problem
- Introducing Overloading
- Overloading More Methods
- Overloading and Associativity
- Full Overloading Implementations
- Automatically Generating Overloaded Methods
- The Fallback Mechanism
- Overloading and Inheritance
- Limitations of Operator Overloading
- Conclusion
- References
- 35. Building Objects Out of Arrays
- OO Basics
- Arrays Are Faster
- Arrays Use Less Space
- Arrays Can Prevent Attribute Collisions
- Arrays Can Prevent Misspellings
- Disadvantages
- Other Approaches
- 36. Hiding Objects with Closures
- A Simple Example
- Closures
- What About Inheritance?
- Conclusion
- 37. Multiple Dispatch in Perl
- Multiple Dispatch
- Multiple Dispatch via Tests-in-Methods
- Multiple Dispatch via a Table
- Initializing the Dispatch Table
- Choosing the Initialization Order
- Comparing the Two Approaches
- Dynamic Dispatch Tables
- The Costs of Extending the Dispatch Table
- Multiple Dispatch and Subroutine Overloading
- The Class::Multimethods Module
- 28. Suffering from Buffering
- V. Software Development
- 38. Using Other Languages from Perl
- Introducing Inline.pm
- A More Complex Example
- Calling C Functions from Perl
- Manipulating Perls Stack
- How Inline Works
- Creating Perl Extensions
- Inline::Config
- XS and SWIG
- Using Perl as Cs Memory Manager
- Benchmarks
- 39. SWIG
- Hooks by Hand
- Wrapping a C Function
- Interface Files
- An In-Depth Example: Emulating top
- From %{ to %}
- After the %{ %} Block
- The top Emulator
- Conclusion
- 40. Benchmarking
- The Trouble with time( )
- Better Resolution with times
- The Benchmark Module
- Example: Summing an Array
- Conclusion
- 41. Building Software with Cons
- Make Doesnt Do the Right Thing
- Build Sequencing
- Variant Builds
- Complexity
- The Solution: Cons
- Cons Scripts Are Perl Scripts
- Cons Does the Right Thing
- Explicit and Implicit Dependencies
- MD5 Cryptographic Signatures
- Automatic, Global Sequencing of Builds
- Summary
- Make Doesnt Do the Right Thing
- 42. MakeMaker
- Reasons to Use MakeMaker
- h2xs
- Components of Makefile.PL
- A Deeper Example
- Advanced Makefile Features
- MakeMaker and Installation of Modules
- perllocal.pod
- 43. Autoloading Perl Code
- Why Autoload?
- Using the AutoLoader
- How Autoloading Works
- AutoSplitting Your Module
- AutoLoading Scripts
- AutoLoading C Programs
- Summary
- 44. Debugging and Devel::
- Runtime Examination of Data
- Profiling and Coverage Testing
- Reference Manipulation
- Helping C and C++ Programmers
- Rolling Your Own
- The DB:: Namespace
- Which Should You Use?
- 38. Using Other Languages from Perl
- VI. Networking
- 45. Email with Attachments
- What Is MIME, and Why Do I Care?
- How Does MIME Encode Data?
- Multiple Pieces of MIME
- How to Create a Mime Message
- An Alternate Route
- A Full-Blown Example
- Conclusion
- 46. Sending Mail Without sendmail
- Some Email Background
- A Store-and-Forward System
- Theres More Than One Way to Deliver Mail
- Standards Governing Email
- The Mail Itself
- The Message Body
- The Message Headers
- The Message Envelope
- Sending Mail in Six Easy Steps
- Step One: Connecting to the Remote SMTP Server
- Step Two: Identifying Yourself
- Step Three: Identifying the Mail Sender
- Step Four: Identifying the Mail Recipients
- Step Five: Sending the Mail
- Step Six: Closing the Connection
- What Next?
- Sending Mail with Mail::Mailer
- Sending Mail with Net::SMTP
- Talking Directly to the Mail Host
- Which Should You Choose?
- Some Email Background
- 47. Filtering Mail
- What Is It?
- A Very Simple Mail Filter
- Separating Mail into Folders
- Mail and News
- A Complete Filter
- Caveats
- Conclusion
- 48. Net::Telnet
- The Problem
- The Solution
- Telnetting the Hard Way
- Telnetting the Easy Way
- Telnetting the Easiest Way
- Special Considerations
- Other Features
- 49. Microsoft Office
- Background
- The Problem
- The Solution
- Wait, Theres More
- 50. Client-Server Applications
- Using the inetd Super-Daemon
- A Standalone Server
- A Threaded Server
- Launching Standalone Servers from inetd
- Further Information
- 51. Managing Streaming Audio
- Playlists, Streams, and ID3 Tags
- Apache::MP3
- Conclusion
- 52. A 74-Line Ip Telephone
- Sound Cards and /dev/dsp
- The Simple Version
- Adding an MP3 Encoder
- Summary
- References
- 53. Controlling Modems
- Initializing Your Modem
- Getting Your Modem to Dial
- To Block or Not to Block?
- Whats Next?
- Afterword
- References
- 54. Using Usenet from Perl
- Finding Newsgroups
- Retrieving Articles
- Posting Articles
- 55. Transferring Files with FTP
- A Simple Example
- Multiple FTP Connections
- Transferring Files Between Servers
- 56. Spidering an FTP Site
- Motivation
- Net::FTP
- Downloading a File (the Simple Case)
- Recursion
- Downloading a File Tree (the Recursive Case)
- Uploading a File (the Simple Case)
- Uploading a File Tree (the Recursive Case)
- Applications
- 57. DNS Updates with Perl
- DNS Basics
- DNS Servers
- Dynamic Update
- Setting Up Your Nameserver
- Delegating the Zone
- Using Net::DNS::Update
- Paths for Futher Exploration
- 45. Email with Attachments
- VII. Databases
- 58. DBI
- The Architecture of DBI
- Why DBI?
- The Modules
- Handles
- Resources
- Sample Code
- 59. Using DBI with Microsoft Access
- The Win32-Access-ODBC-DBI::DBD Checklist:
- References
- 60. DBI Caveats
- DBI and Loops
- Placeholders
- Fetches
- Bind Columns
- Error Checking
- Transactions
- References
- 61. Beyond Hardcoded Database Applications with DBIx::Recordset
- CRUD Without SQL
- Sample Usage
- A DBI Version
- Conclusion
- 62. Win32::ODBC
- Win32::ODBC Basics
- Demystifying SQL
- Installing Win32::ODBC
- Getting Started
- Debugging
- CRUD
- Transactions
- Data Sources
- Data Dictionary
- Conclusion
- 63. Net::LDAP
- What Is LDAP?
- Setting Up an OpenLDAP Server
- Loading Data into the Directory
- A Searchable Web Interface to Manage Your Directory
- Where LDAP Is Going
- References
- 64. Web Databases the Genome Project Way
- The ACEDB Database
- ACEDB Objects and Classes
- Accessing ACEDB from Perl
- ACEDB Meets the Web
- Registering ACEDB Displays
- Conclusions
- References
- 65. Spreadsheet::WriteExcel
- Using Spreadsheet::WriteExcel
- How the Spreadsheet::WriteExcel Module Works
- The Excel Binary Interchange File Format
- A Brief History of Time Wasted
- The pack Programming Language
- The Structure of the Module
- Alternative Ways of Writing to Excel
- Reading from Excel
- Win32::OLE
- Obtaining Spreadsheet::WriteExcel
- References
- 58. DBI
- VIII. Internals
- 66. How to Improve Perl
- 67. Components of the Perl Distribution
- The Components of Perl
- The Core
- The Standard Library
- Configuration and Installation
- Test Suite
- Utilities
- Summary
- The Components of Perl
- 68. Basic Perl Anatomy
- How Perl Works
- Lexical Analysis
- Parsing
- Compilation
- Execution
- Perl Subsystems
- For Further Reading
- 69. Lexical Analysis
- Tokenizing
- Perls Lexer
- Lexer Variables
- Tokenizing Considerations
- Further Information
- 70. Debugging Perl Programs with -D
- What -D Does for You
- Trace Execution with -Dt
- Stack Snapshots with -Ds
- Syntax Tree Dump with -Dx
- Regular Expression Parsing and Execution with -Dr
- Method and Overloading Resolution with -Do
- Context (Loop) Stack Processing with -Dl
- Tokenizing and Parsing with -Dp
- Other -D Debugging Flags
- 71. Microperl
- Bootstrapping
- Building Microperl
- How Microperl Works
- Practical Uses for Microperl
- Problems
- Future Work
- Index
- Colophon
- Copyright