Synopses & Reviews
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)
- 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.
This book covers complex techniques for managing production-ready Perl programs and explains methods for manipulating data and objects that may have looked like magic before. It gives you necessary background for dealing with networks, databases, and GUIs, and includes a discussion of internals to help you program more efficiently, and imbed Perl within C when necessary.
System requirements: Browser software (such as Netscape, Internet Explorer, or Lynx) supporting HTML 4.0 or earlier versions), JAVA run-tim interpreters (for searching) for most versions of Linux, Unix, Macintosh, Windows 95, Windows 98, and Windows NT are included on the CD-ROM. Includes bibliographical references and index. On CD-ROM with: Perl in a nutshell, Programming Perl, 2nd ed., Perl cookbook, Learning Perl, 2nd ed., Learning Perl on Win32 systems.
About the Author
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, ...".
Table of Contents
Preface; The Case for Scripting; Why Perl?; What Must I Know?; The Book's Approach; Conventions; Resources; Perl Resources; We'd Like to Hear from You; Acknowledgments; Chapter 1: Data References and Anonymous Storage; 1.1 Referring to Existing Variables; 1.2 Using References; 1.3 Nested Data Structures; 1.4 Querying a Reference; 1.5 Symbolic References; 1.6 A View of the Internals; 1.7 References in Other Languages; 1.8 Resources; Chapter 2: Implementing Complex Data Structures; 2.1 User-Defined Structures; 2.2 Example: Matrices; 2.3 Professors, Students, Courses; 2.4 Pass the Envelope; 2.5 Pretty-Printing; 2.6 Resources; Chapter 3: Typeglobs and Symbol Tables; 3.1 Perl Variables, Symbol Table, and Scoping; 3.2 Typeglobs; 3.3 Typeglobs and References; 3.4 Filehandles, Directory Handles, and Formats; Chapter 4: Subroutine References and Closures; 4.1 Subroutine References; 4.2 Using Subroutine References; 4.3 Closures; 4.4 Using Closures; 4.5 Comparisons to Other Languages; 4.6 Resources; Chapter 5: Eval; 5.1 The String Form: Expression Evaluation; 5.2 The Block Form: Exception Handling; 5.3 Watch Your Quotes; 5.4 Using Eval for Expression Evaluation; 5.5 Using Eval for Efficiency; 5.6 Using Eval for Time-Outs; 5.7 Eval in Other Languages; 5.8 Resources; Chapter 6: Modules; 6.1 Basic Package; 6.2 Packages and Files; 6.3 Package Initialization and Destruction; 6.4 Privacy; 6.5 Importing Symbols; 6.6 Nesting Packages; 6.7 Autoloading; 6.8 Accessing the Symbol Table; 6.9 Language Comparisons; Chapter 7: Object-Oriented Programming; 7.1 OO: An Introduction; 7.2 Objects in Perl; 7.3 UNIVERSAL; 7.4 Recap of Conventions; 7.5 Comparison with Other OO Languages; 7.6 Resources; Chapter 8: Object Orientation: The Next Few Steps; 8.1 Efficient Attribute Storage; 8.2 Delegation; 8.3 On Inheritance; 8.4 Resources; Chapter 9: Tie; 9.1 Tying Scalars; 9.2 Tying Arrays; 9.3 Tying Hashes; 9.4 Tying Filehandles; 9.5 Example: Monitoring Variables; 9.6 Comparisons with Other Languages; Chapter 10: Persistence; 10.1 Persistence Issues; 10.2 Streamed Data; 10.3 Record-Oriented Approach; 10.4 Relational Databases; 10.5 Resources; Chapter 11: Implementing Object Persistence; 11.1 Adaptor: An Introduction; 11.2 Design Notes; 11.3 Implementation; 11.4 Resources; Chapter 12: Networking with Sockets; 12.1 Networking Primer; 12.2 Socket API and IO::Socket; 12.3 Handling Multiple Clients; 12.4 Real-World Servers; 12.5 IO Objects and Filehandles; 12.6 Prebuilt Client Modules; 12.7 Resources; Chapter 13: Networking: Implementing RPC; 13.1 Msg: Messaging Toolkit; 13.2 Remote Procedure Calls (RPC); 13.3 Resources; Chapter 14: User Interfaces with Tk; 14.1 Introduction to GUIs, Tk, and Perl/Tk; 14.2 Starting with Perl/Tk; 14.3 Widget Tour; 14.4 Geometry Management; 14.5 Timers; 14.6 Event Bindings; 14.7 Event Loops; 14.8 Resources; Chapter 15: GUI Example: Tetris; 15.1 Introduction to Tetris; 15.2 Design; 15.3 Implementation; Chapter 16: GUI Example: Man Page Viewer; 16.1 man and perlman; 16.2 Implementation; 16.3 Resources; Chapter 17: Template-DrivenCode Generation; 17.1 On Code Generation; 17.2 Jeeves Example; 17.3 Jeeves Overview; 17.4 Jeeves Implementation; 17.5 Sample Specification Parser; 17.6 Resources; Chapter 18: Extending Perl: A First Course; 18.1 Writing an Extension: Overview; 18.2 Example: Fractals with Perl; 18.3 SWIG Features; 18.4 XS Features; 18.5 Degrees of Freedom; 18.6 A Detour into Fractals; 18.7 Resources; Chapter 19: Embedding Perl:The Easy Way; 19.1 Why Embed?; 19.2 Embedding Overview; 19.3 Examples; 19.4 Adding Extensions; 19.5 Resources; Chapter 20: Perl Internals; 20.1 Reading the Source; 20.2 Architecture; 20.3 Perl Value Types; 20.4 Stacks and Messaging Protocol; 20.5 Meaty Extensions; 20.6 Easy Embedding API; 20.7 A Peek into the Future; 20.8 Resources; Tk Widget Reference; Button; Canvas; Entry; Listbox; Menus; Scrollbars and Scrolling; Scale; HList -- Hierarchical List; Syntax Summary; References; Nested Data Structures; Closures; Modules; Objects; Dynamic Behavior; Exception Handling; Meta-Information; Typeglobs; Filehandles, Formats; Colophon;