The Complete Reference Second Edition pot

1.2K 415 0
The Complete Reference Second Edition pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

TEAMFLY Team-Fly ® Perl: The Complete Reference Second Edition This page intentionally left blank. Perl: The Complete Reference Second Edition Martin C. Brown Osborne/McGraw-Hill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2001 by The McGraw-Hill Companies. All rights reserved. Manufactured in the United States of America. Except as per- mitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. 0-07-219425-1 The material in this eBook also appears in the print version of this title: 0-07-212950-6. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trade- marked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringe- ment of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior con- sent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS”. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the con- tent of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause what- soever whether such claim or cause arises in contract, tort or otherwise. DOI: 10.1036/0072194251 To Darcy and Leon, two little kittens who do try to help daddy with the typing, but usually just end up typing “jjskdjjvoookko000000000000000000000” About the Author Martin C. Brown is the author of six Perl books, including the first edition of Perl: The Complete Reference, Perl Programmer’s Reference, ActivePerl Developer’s Guide, and Debugging Perl. In addition to Perl, he has worked in Python, Java, Visual Basic, and other languages. A programmer for 15 years, he is the former IT director of a large advertising agency dealing with blue chip clients such as Hewlett Packard, Oracle, and Cable & Wireless. Copyright 2001 The McGraw-Hill Companies, Inc. Click Here for Terms of Use. Contents at a Glance Part I Fundamentals 1 Perl Backgrounder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Perl Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3 Perl Parsing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4 Variables and Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5 Statements and Control Structures . . . . . . . . . . . . . . . . . . 109 6 Subroutines, Packages, and Modules . . . . . . . . . . . . . . . . 123 7 Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 8 Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 9 Errors and Trapping Them . . . . . . . . . . . . . . . . . . . . . . . . . 269 Part II Programming with Perl 10 Complex Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . 287 11 System Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 12 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 vii Copyright 2001 The McGraw-Hill Companies, Inc. Click Here for Terms of Use. 13 Database Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 14 Interprocess Communication . . . . . . . . . . . . . . . . . . . . . . . 447 15 Other Execution Enhancements . . . . . . . . . . . . . . . . . . . . . 479 Part III Developing Applications 16 User Interface Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 17 Advanced User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 529 18 Developing for the World Wide Web (WWW) . . . . . . . . 575 19 Controlling Execution with Pragmas . . . . . . . . . . . . . . . . 611 20 Extending and Embedding Perl . . . . . . . . . . . . . . . . . . . . . 641 Part IV Fine-Tuning Applications 21 Debugging and Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 22 Perl Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 23 Perl Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803 24 Cross-Platform Migration Traps . . . . . . . . . . . . . . . . . . . . 825 25 Distributing Modules and Applications . . . . . . . . . . . . . . 837 Part V Appendixes A Function Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869 B Standard Perl Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 C Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1141 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1153 viii Perl: The Complete Reference Contents Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxv Part I Fundamentals 1 Perl Backgrounder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Versions and Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Perl, perl or PeRl? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Life Before Perl 5.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Perl History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Main Perl Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Perl Is Free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Perl Is Simple to Learn, Concise, and Easy to Read . . . . . . 7 Perl Is Fast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Perl Is Extensible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Perl Has Flexible Data Types . . . . . . . . . . . . . . . . . . . . . . . . . 8 Perl Is Object Oriented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Perl Is Collaborative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Compiler or Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 ix Copyright 2001 The McGraw-Hill Companies, Inc. Click Here for Terms of Use. [...]... irst of all, I’d like to thank my wife Two years ago, based on the offer for the first edition of Perl: The Complete Reference, she stood by me when I wanted to start writing full time Without her continued support, I wouldn’t have written the first edition or the various other books that I’ve written since then, or been able to do this second edition Meanwhile, she still gives advice, listens to my rants... provide a reference guide to everything you could possibly want to know about Perl I’ve done my best to try and cover all the different aspects, from the core of the language to the different functions, and on into the different tasks and areas of the Perl language I even cover how to debug your software, write documentation, and then build and distribute your applications or modules to the world at... The Warn Function The Die Function Directives and Tokens 270 270 272 273 274 275 275 276 277 279 279 280 280 xiii xiv Perl: The Complete Reference Reporting Errors Within Modules The Carp Function The Cluck Function ... The $^W Variable The Old warnings Pragma Lexical Warnings in Perl 5.6 The strict Pragma The vars Option The refs Option The subs Option Other Perl Pragmas... large Along the way, we also look at some nonstandard features and extensions, including better ways of networking, web programming, and designing interfaces Throughout the entire book, you’ll find real-world examples and guides on how to approach real problems using Perl—not just how to use the features of Perl If all you want is a quick reference guide to the different areas of Perl, then use the appendixes... the different areas of Perl, then use the appendixes at the end of the book and on the Web at www.osborne.com, which cover basic components, functions, the Perl standard library, CPAN (Comprehensive Perl Archive Network) extension library, a complete guide to errors and warnings, and a list of resources for more information T xxxv Copyright 2001 The McGraw-Hill Companies, Inc Click Here for Terms of... 531 532 533 533 533 xvii xviii Perl: The Complete Reference Event Loops Widgets Controlling Window Geometry Easing the Process 537 540 563 567 19 Developing for the World Wide Web (WWW) 575 HTML ... Embedding the Perl Interpreter Using a Specific Perl Function Multiplicity XS Initialization Cooperating with Other Languages Converting Other Languages to Perl Converting Perl to Other Languages Calling Other Languages... Package Symbol Tables 125 127 137 138 138 139 141 143 145 xi xii Perl: The Complete Reference Special Blocks Modules Creating Modules The Exporter Module Comparing use and require no... The Croak Function The Confess Function 281 282 283 283 283 Part II Programming with Perl 11 Complex Data Structures 287 Accessing Packed Data Structures References Creating Hard References . Team-Fly ® Perl: The Complete Reference Second Edition This page intentionally left blank. Perl: The Complete Reference Second Edition Martin C. Brown Osborne/McGraw-Hill New. is the author of six Perl books, including the first edition of Perl: The Complete Reference, Perl Programmer’s Reference, ActivePerl Developer’s Guide,

Ngày đăng: 18/03/2014, 00:20

Từ khóa liên quan

Mục lục

  • sample.pdf

    • sterling.com

      • Welcome to Sterling Software

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan