Pro Perl Debugging.pdf
(
2254 KB
)
Pobierz
674215092 UNPDF
Pro Perl Debugging
From Professional to Expert
RICHARD FOLEY WITH ANDY LESTER
Pro Perl Debugging: From Professional to Expert
Copyright © 2005 by Richard Foley with Andy Lester
Lead Editor: Jason Gilmore
Technical Reviewer: Andy Lester
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore,
Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser
Associate Publisher: Grace Wong
Project Manager: Emily K. Wolman
Copy Edit Manager: Nicole LeClerc
Copy Editor: Julie Smith
Production Manager: Kari Brooks-Copony
Production Editor: Linda Marousek
Compositor and Artist: Kinetic Publishing Services, LLC
Proofreader: Sue Boshers
Indexer: Rebecca Plunkett
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Library of Congress Cataloging-in-Publication Data
Foley, Richard.
Pro Perl debugging : from professional to expert / Richard Foley with
Andy Lester.
p. cm.
Includes bibliographical references and index.
ISBN 1-59059-454-1 (alk. paper)
1. Perl (Computer program language) 2. Debugging in computer science.
I. Lester, Andy. II. Title.
QA76.73.P22F62 2005
005.13
3—dc22
2005016006
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN: 1-59059-454-1
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17,
69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail
orders@springer-ny.com
, or visit
http://www.springer-ny.com
. Outside the United States: fax +49 6221 345229, e-mail
orders@springer.de
,
or visit
http://www.springer.de
.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail
info@apress.com
, or visit
http://www.apress.com
.
The information in this book is distributed on an “as is” basis, without warranty. Although every precau-
tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liabil-
ity to any person or entity with respect to any loss or damage caused or alleged to be caused directly or
indirectly by the information contained in this work.
The source code for this book is available to readers at
http://www.apress.com
in the Downloads section.
You will need to answer questions pertaining to this book in order to successfully download the code.
′
I’d like to dedicate this book to my wife, Joy, and to my daughters, Catherine and Jennifer.
Without them it would all seem rather pointless—even if they do call me an angeber
(show-off ) while pointing to daddy’s name as the actual author of a programming book.
And to Spot, for being a friend for 15 years.
—Richard
For Amy and Quinn, the two girls who make me laugh the most.
—Andy
Contents at a Glance
About the Authors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
CHAPTER 1
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
CHAPTER 2
Inspecting Variables and Getting Help
. . . . . . . . . . . . . . . . . . . . . . . . . . . 7
CHAPTER 3
Controlling Program Execution
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
CHAPTER 4
Debugging a Simple Command Line Program
. . . . . . . . . . . . . . . . . . . 39
CHAPTER 5
Tracing Execution
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 6
Debugging Modules
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
CHAPTER 7
Debugging Object-Oriented Perl
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
CHAPTER 8
Using the Debugger As a Shell
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CHAPTER 9
Debugging a CGI Program
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
CHAPTER 10
Perl Threads and Forked Processes
. . . . . . . . . . . . . . . . . . . . . . . . . . . 153
CHAPTER 11
Debugging Regular Expressions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
CHAPTER 12
Debugger Customization
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
CHAPTER 13
Optimization and Performance Hints and Tips
. . . . . . . . . . . . . . . . . 211
CHAPTER 14
Command Line and GUI Debuggers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
CHAPTER 15
Comprehensive Command Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . 239
CHAPTER 16
Book References and URLs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
v
Contents
About the Authors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
CHAPTER 1
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What Is It?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Down the Rabbit Hole
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Why Should You Use the Perl Debugger?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Using the Debugger
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Book Layout
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Section 1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Section 2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Section 3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Technical Notes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Development
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
CHAPTER 2
Inspecting Variables and Getting Help
. . . . . . . . . . . . . . . . . . . . . 7
A Gentle Introduction to the Debugger
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Reviewing the Debugger Help Page
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Going Beyond Help
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Supplying a Program Name
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
CHAPTER 3
Controlling Program Execution
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A Sample Program: charcount
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Running charcount
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Debugging a Perl Program
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Reviewing Executed Code
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
vii
■
■
■
Plik z chomika:
r41lblast
Inne pliki z tego folderu:
A Tester's Guide to .NET Programming.pdf
(20132 KB)
A Programmer's Introduction to PHP 4.0.pdf
(4311 KB)
Accelerated CSharp 2010.pdf
(7008 KB)
Accelerated CSharp 2008.pdf
(6166 KB)
Adobe Coldfusion Anthology.pdf
(31579 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
C#
c# - C sharp
Dokumenty
Galeria
Zgłoś jeśli
naruszono regulamin