Advanced Perl Programming

Front Cover
"O'Reilly Media, Inc.", 1997 - Computers - 404 pages

So you've learned Perl, but you're getting frustrated. Perhaps you've taken on a larger project than the ones you're used to. Or you want to add a user interface or a networking component. Or you need to do more complicated error trapping.

Whether your knowledge of Perl is casual or deep, this book will make you a more accomplished programmer. Here you can learn the complex techniques for production-ready Perl programs. This book explains methods for manipulating data and objects that may have looked like magic before. Furthermore, it sets Perl in the context of a larger environment, giving you the background you need for dealing with networks, databases, and GUIs. The discussion of internals helps you program more efficiently and embed Perl within C or C within Perl.

Major topics covered include:

  • Practical use of packages and classes (object-oriented programming)
  • Complex data structures
  • Persistence (e.g., using a database)
  • Networking
  • Graphical interfaces, using the Tk toolkit
  • Interaction with C language functions
  • Embedding and extending the Perl interpreter

In addition, the book patiently explains all sorts of language details you've always wanted to know more about, such as the use of references, trapping errors through the eval operator, non-blocking I/O, when closures are helpful, and using ties to trigger actions when data is accessed. You will emerge from this book a better hacker, and a proud master of Perl.

 

Selected pages

Contents

Data References and Anonymous Storage
1
Referring to Existing Variables
3
Using References
8
Nested Data Structures
13
Querying a Reference
15
Symbolic References
16
A View of the Internals
17
References in Other Languages
21
RecordOriented Approach
159
Relational Databases
161
Resources
167
Implementing Object Persistence
168
An Introduction
170
Design Notes
173
Implementation
179
Resources
187

Resources
22
Implementing Complex Data Structures
23
UserDefined Structures
24
Matrices
25
Professors Students Courses
28
Pass the Envelope
32
PrettyPrinting
34
Resources
37
Typeglobs and Symbol Tables
38
Perl Variables Symbol Table and Scoping
39
Typeglobs
42
Typeglobs and References
47
Filehandles Directory Handles and Formats
48
Subroutine References and Closures
51
Using Subroutine References
53
Closures
56
Using Closures
59
Comparisons to Other Languages
64
Resources
65
Eval
66
Expression Evaluation
67
Exception Handling
69
Watch Your Quotes
72
Using Eval for Efficiency
74
Using Eval for TimeOuts
80
Eval in Other Languages
81
Resources
83
Modules
84
Basic Package
85
Packages and Files
87
Package Initialization and Destruction
88
Privacy
89
Importing Symbols
91
Nesting Packages
93
Autoloading
94
Accessing the Symbol Table
95
Language Comparisons
97
ObjectOriented Programming
99
Objects in Perl
101
UNIVERSAL
114
Recap of Conventions
116
Comparison with Other OO Languages
120
Resources
121
Object Orientation The Next Few Steps
123
Delegation
134
On Inheritance
135
Resources
137
Tie
138
Tying Scalars
139
Tying Arrays
142
Tying Hashes
144
Tying Filehandles
146
Comparisons with Other Languages
151
Persistence
153
Persistence Issues
154
Streamed Data
156
Networking with Sockets
189
Socket
191
Handling Multiple Clients
193
RealWorld Servers
199
IO Objects and Filehandles
200
Prebuilt Client Modules
201
Resources
202
Networking Implementing RFC
203
Remote Procedure Calls RPC
215
Resources
221
User Interfaces with Tk
222
Starting with PerlTk
224
Widget Tour
226
Geometry Management
244
Timers
247
Event Bindings
248
Event Loops
250
Resources
251
GUI Example Tetris
252
Design
253
Implementation
255
GUI Example Man Page Viewer
261
Implementation
263
Resources
269
TemplateDriven Code Generation
270
Jeeves Example
273
Jeeves Overview
278
Jeeves Implementation
280
Sample Specification Parser
287
Resources
289
Extending Perl A First Course
290
Overview
291
Fractals with Perl
294
SWIG Features
297
XS Features
301
Degrees of Freedom
304
A Detour into Fractals
305
Resources
308
Embedding Perl The Easy Way
309
Embedding Overview
311
Examples
313
Adding Extensions
316
Resources
317
Perl Internals
319
Reading the Source
320
Architecture
321
Perl Value Types
328
Stacks and Messaging Protocol
351
Meaty Extensions
357
Easy Embedding API
367
A Peek into the Future
369
Resources
370
Tk Widget Reference
373
Syntax Summary
386
Index
393
Copyright

Other editions - View all

Common terms and phrases

About the author (1997)

Sriram Srinivasan ("Ram") is an expert on distributed object technologies, and develops Java middleware at WebLogic, San Francisco, for fun and profit. He actively pursues his interests in programming languages, databases, transaction processing, networking, and meaningful user interfaces. Sriram has been an enthusiastic user and teacher of Perl for the last six years, and currently teaches a course on advanced Perl programming for the extension program at the University of California at Berkeley. In his spare time, he dabbles in Indian classical music, charcoal drawing, cooking, and biking, and dreams of the day when he can say, "In his spare time, he dabbles in programming languages,...".

Bibliographic information