Whether your knowledge of Perl is casual or deep, this book will make you a more accomplished programmer. It covers complex techniques for managing production-ready Perl programs and 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. It also includes a discussion of internals to help you program more efficiently and embed Perl within C or C within Perl. Major topics include the 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, and selected internals. Advanced Perl Programming -1 Scroll down to the Underground 1 Table of Contents 2 Preface 4 [Preface] Why Perl? 7 [Preface] What Must I Know? 9 [Preface] The Book's Approach 13 [Preface] Conventions 16 [Preface] Resources 17 [Preface] Perl Resources 18 [Preface] We'd Like to Hear from You 19 [Preface] Acknowledgments 20 [Chapter 1] Data References and Anonymous Storage 22 [Chapter 1] 1.2 Using References 30 [Chapter 1] 1.3 Nested Data Structures 35 [Chapter 1] 1.4 Querying a Reference 38 [Chapter 1] 1.5 Symbolic References 39 [Chapter 1] 1.6 A View of the Internals 41 [Chapter 1] 1.7 References in Other Languages 46 [Chapter 1] 1.8 Resources 48 [Chapter 2] Implementing Complex Data Structures 49 [Chapter 2] 2.2 Example: Matrices 52 [Chapter 2] 2.3 Professors, Students, Courses 56 [Chapter 2] 2.4 Pass the Envelope 60 [Chapter 2] 2.5 Pretty-Printing 63 [Chapter 2] 2.6 Resources 67 [Chapter 3] Typeglobs and Symbol Tables 68 [Chapter 3] 3.2 Typeglobs 73 [Chapter 3] 3.3 Typeglobs and References 78 [Chapter 3] 3.4 Filehandles, Directory Handles, and Formats 80 [Chapter 4] Subroutine References and Closures 83 [Chapter 4] 4.2 Using Subroutine References 86 [Chapter 4] 4.3 Closures 89 [Chapter 4] 4.4 Using Closures 92 [Chapter 4] 4.5 Comparisons to Other Languages 98 [Chapter 4] 4.6 Resources 100 [Chapter 5] Eval 101 [Chapter 5] 5.2 The Block Form: Exception Handling 105 [Chapter 5] 5.3 Watch Your Quotes 108 [Chapter 5] 5.4 Using Eval for Expression Evaluation 110 [Chapter 5] 5.5 Using Eval for Efficiency 112 [Chapter 5] 5.6 Using Eval for Time-Outs 118 [Chapter 5] 5.7 Eval in Other Languages 120 [Chapter 5] 5.8 Resources 122 [Chapter 6] Modules 123 [Chapter 6] 6.2 Packages and Files 127 [Chapter 6] 6.3 Package Initialization and Destruction 129 [Chapter 6] 6.4 Privacy 131 [Chapter 6] 6.5 Importing Symbols 133 [Chapter 6] 6.6 Nesting Packages 136 [Chapter 6] 6.7 Autoloading 137 [Chapter 6] 6.8 Accessing the Symbol Table 139 [Chapter 6] 6.9 Language Comparisons 142 [Chapter 7] Object-Oriented Programming 144 [Chapter 7] 7.2 Objects in Perl 147 [Chapter 7] 7.3 UNIVERSAL 160 [Chapter 7] 7.4 Recap of Conventions 162 [Chapter 7] 7.5 Comparison with Other OO Languages 166 [Chapter 7] 7.6 Resources 168 [Chapter 8] Object Orientation: The Next Few Steps 170 [Chapter 8] 8.2 Delegation 181 [Chapter 8] 8.3 On Inheritance 183 [Chapter 8] 8.4 Resources 186 [Chapter 9] Tie 187 [Chapter 9] 9.2 Tying Arrays 192 [Chapter 9] 9.3 Tying Hashes 195 [Chapter 9] 9.4 Tying Filehandles 197 [Chapter 9] 9.5 Example: Monitoring Variables 198 [Chapter 9] 9.6 Comparisons with Other Languages 204 [Chapter 10] Persistence 206 [Chapter 10] 10.2 Streamed Data 210 [Chapter 10] 10.3 Record-Oriented Approach 213 [Chapter 10] 10.4 Relational Databases 216 [Chapter 10] 10.5 Resources 222 [Chapter 11] Implementing Object Persistence 223 [Chapter 11] 11.2 Design Notes 228 [Chapter 11] 11.3 Implementation 234 [Chapter 11] 11.4 Resources 243 [Chapter 12] Networking with Sockets 245 [Chapter 12] 12.2 Socket API and IO::Socket 248 [Chapter 12] 12.3 Handling Multiple Clients 251 [Chapter 12] 12.4 Real-World Servers 257 [Chapter 12] 12.5 IO Objects and Filehandles 259 [Chapter 12] 12.6 Prebuilt Client Modules 261 [Chapter 12] 12.7 Resources 263 [Chapter 13] Networking: Implementing RPC 264 [Chapter 13] 13.2 Remote Procedure Calls (RPC) 277 [Chapter 13] 13.3 Resources 283 [Chapter 14] User Interfaces with Tk 284 [Chapter 14] 14.2 Starting with Perl/Tk 287 [Chapter 14] 14.3 Widget Tour 290 [Chapter 14] 14.4 Geometry Management 306 [Chapter 14] 14.5 Timers 310 [Chapter 14] 14.6 Event Bindings 311 [Chapter 14] 14.7 Event Loops 314 [Chapter 14] 14.8 Resources 316 [Chapter 15] GUI Example: Tetris 317 [Chapter 15] 15.2 Design 319 [Chapter 15] 15.3 Implementation 321 [Chapter 16] GUI Example: Man Page Viewer 328 [Chapter 16] 16.2 Implementation 331 [Chapter 16] 16.3 Resources 339 [Chapter 17] Template-Driven Code Generation 340 [Chapter 17] 17.2 Jeeves Example 344 [Chapter 17] 17.3 Jeeves Overview 349 [Chapter 17] 17.4 Jeeves Implementation 352 [Chapter 17] 17.5 Sample Specification Parser 360 [Chapter 17] 17.6 Resources 363 [Chapter 18] Extending Perl:A First Course 364 [Chapter 18] 18.2 Example: Fractals with Perl 369 [Chapter 18] 18.3 SWIG Features 373 [Chapter 18] 18.4 XS Features 376 [Chapter 18] 18.5 Degrees of Freedom 380 [Chapter 18] 18.6 A Detour into Fractals 381 [Chapter 18] 18.7 Resources 385 [Chapter 19] Embedding Perl:The Easy Way 386 [Chapter 19] 19.2 Embedding Overview 389 [Chapter 19] 19.3 Examples 392 [Chapter 19] 19.4 Adding Extensions 396 [Chapter 19] 19.5 Resources 398 [Chapter 20] Perl Internals 399 [Chapter 20] 20.2 Architecture 402 [Chapter 20] 20.3 Perl Value Types 409 [Chapter 20] 20.4 Stacks and Messaging Protocol 431 [Chapter 20] 20.5 Meaty Extensions 438 [Chapter 20] 20.6 Easy Embedding API 446 [Chapter 20] 20.7 A Peek into the Future 449 [Chapter 20] 20.8 Resources 451 [Appendix A] Tk Widget Reference 453 [Appendix A] A.2 Canvas 457 [Appendix A] A.3 Entry 463 [Appendix A] A.4 Listbox 465 [Appendix A] A.5 Menus 467 [Appendix A] A.6 Scrollbars and Scrolling 470 [Appendix A] A.7 Scale 472 [Appendix A] A.8 HList€- Hierarchical List 473 [Appendix B] Syntax Summary 475 [Appendix B] B.2 Nested Data Structures 477 [Appendix B] B.3 Closures 479 [Appendix B] B.4 Modules 480 [Appendix B] B.5 Objects 482 [Appendix B] B.6 Dynamic Behavior 484 [Appendix B] B.7 Exception Handling 485 [Appendix B] B.8 Meta-Information 486 [Appendix B] B.9 Typeglobs 487 [Appendix B] B.10 Filehandles, Formats 488 Index 489 Index: Symbols and Numbers 489 Index: A 490 Index: B 494 Index: C 496 Index: D 500 Index: E 503 Index: F 506 Index: G 508 Index: H 510 Index: I 512 Index: J 514 Index: K 515 Index: L 516 Index: M 518 Index: N 521 Index: O 523 Index: P 525 Index: Q 530 Index: R 531 Index: S 534 Index: T 540 Index: U 543 Index: V 544 Index: W 546 Index: X 547 Index: Y 548 Index: Z 549 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. Techniques For Managing Production-ready Perl Programs Are Covered In This Book, Which Also Outlines Methods For Manipulating Data And Objects . It Gives Background For Dealing With Networks, Databases, And Guis, And Includes A Discussion Of Internals To Help Readers Program More Efficiently. 1. Data References And Anonymous Storage -- 2. Implementing Complex Data Structures -- 3. Typeglobs And Symbol Tables -- 4. Subroutine References And Closures -- 5. Eval -- 6. Modules -- 7. Object-oriented Programming -- 8. Object Orientation: The Next Few Steps -- 9. Tie -- 10. Persistence -- 11. Implementing Object Persistence -- 12. Networking With Sockets -- 13. Networking: Implementing Rpc -- 14. User Interfaces With Tk -- 15. Gui Example: Tetris -- 16. Gui Example: Man Page Viewer -- 17. Template-driven Code Generation -- 18. Extending Perl: A First Course -- 19. Embedding Perl: The Easy Way -- 20. Perl Internals -- A. Tk Widget Reference -- B. Syntax Summary. Sriram Srinivasan. Includes Bibliographical References And Index. "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."--BOOK JACKET. "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."--BOOK JACKET. This publication advances your Perl scripting. skills beyond the bounds of elementary script constructs, and into the realm of production-ready scripts within the context of network, database and GUI environments. Covers such advanced features as run-time evaluation, persistence, code generation, and the innards of the Perl interpreter. Discusses data references, complex data structure implementation, typeglobs, symbol tables, structure references and closures. Reviews object-oriented programming, then dives into the essence of this publication, sockets networking, RPC implementation, and Perl/Tk user interface scripting. Examines template driven code generation, and shows how to extend Perl and embed scripts.