Catálogo de publicaciones - libros

Compartir en
redes sociales


Pro Perl Debugging: From Professional to Expert

Richard Foley Andy Lester

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

Software Engineering/Programming and Operating Systems

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2005 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-59059-454-4

ISBN electrónico

978-1-4302-0044-4

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Apress 2005

Tabla de contenidos

Introduction

Richard Foley; Andy Lester

By the conclusion of this introductory chapter, you should have a good overview of the Perl debugger itself, and of how this book will approach the subject of debugging Perl programs. You should be able to start the debugger, execute some Perl code or a debugger command, and quit the debugger and return to your operating system environment.

The next chapter will discuss the most commonly used commands for inspecting the environment of your program, and how to list the code and inspect the runtime variables within it. We also find out how to use the built-in help facility to get more information for a particular command from both the debugger and the system itself.

Pp. 1-6

Inspecting Variables and Getting Help

Richard Foley; Andy Lester

In this chapter we have shown several of the most common commands available to list both your code and the libraries it uses. You now know how to inspect any of the variables in your package or in any other package, at runtime.

You can now find out which methods and subroutines are available at any place in the program, either to a particular object or to a class. You can repeat recent commands or one which was run much earlier in the program and you know it would be laborious to have to type in all over again—now you can simply use the command history mechanism.

Finally, you know how to query the debugger help and the system manpages, to find an explanation of any available command or system call, while your program is running and while you retain control over it.

While this chapter has been primarily concerned with the runtime execution of your program, the next chapter discusses how to it.

Pp. 7-19

Controlling Program Execution

Richard Foley; Andy Lester

In this chapter you have learned how to work with the most commonly used debugger motion commands. You’ve learned to move around a piece of a real program code and control its execution by setting and deleting conditional breakpoints to stop your program under certain circumstances.

You’ve also learned how to set up an action that is triggered when the program passes a particular line of code, and how to watch the variables and stop the program when their values change. You now have the skills to step in and over both subroutines and method calls, and you know how to continue to either the next stopping position or end of the program. For a list of all available commands, and many other options, see the reference section at the end of the book.

The rest of this book takes the reader through various real-life debugging scenarios and introduces many techniques along the way. In particular, the next chapter looks at a real debugging session of a Perl program.

Pp. 21-38

Debugging a Simple Command Line Program

Richard Foley; Andy Lester

In this chapter you’ve learned how to use the debugger to actually enter, control, modify, and debug a simple Perl program.

You should now be able to approach any Perl debugging problem with some confidence. Rather than remaining at the mercy of your code, whether you wrote it or because you are now responsible for maintaining it, you can now use a number of different techniques to completely inspect, instruct, change, and control its execution and behavior. Additionally, you can take a modified source file and find the differences between it and the original, before finally applying the fixes to the original file. You know how to do this in a reliable and predictable sequence, suitable for a production environment.

The rest of the book concentrates less on fixing a particular problem, and more on learning the various techniques available. In particular, the next chapter takes a look at how to approach debugging programs using the tracing facilities of the Perl debugger. You’ll use tracing abilities to find out where elements of your program were called from and with what arguments.

Pp. 39-64

Tracing Execution

Richard Foley; Andy Lester

In this chapter you’ve learned how to use the debugger to conditionally trace your programs, and even your individual statements. You’ve learned how tracing can reveal to you the inner workings of libraries and modules, by the use of customized stack traces, not only your code, but also code which your program uses and that you have never even seen, let alone written.

The next chapter explores several specialized breakpoint commands for working with multiple libraries and modules, and teaches you to access and control chunks of code at both runtime and compiletime.

Pp. 65-78

Debugging Modules

Richard Foley; Andy Lester

In this chapter you have learned how to use the special breakpoint setting commands within the debugger, and used these commands to control program execution across multiple libraries at both compiletime and runtime.

You can use these commands to stop a program, not just at the first executable line of your main program, but also before it has even been loaded completely. You can do this before a BEGIN block has been run, or inside a BEGIN block of another module or library. You can gain control of the program in order to debug it, and any libraries it uses, thoroughly.

The next chapter explores the special case of debugging a program with recursive or otherwise complex functions.

Pp. 79-102

Debugging Object-Oriented Perl

Richard Foley; Andy Lester

In this chapter you have learned how to use the Perl debugger to walk through an object-oriented Perl program, and how to find the methods available to you for each object. You’ve also learned how to inspect the call tree, via a stack trace on an expression, which allows you to see what will happen when an object is called with an apparently unrecognized method or argument.

In the next chapter we’ll take a look at how you can use the Perl debugger as a shell and how to use it to experiment with code constructs on the fly.

Pp. 103-117

Using the Debugger As a Shell

Richard Foley; Andy Lester

In this chapter you’ve discovered how to use the Perl debugger as a shell for executing arbitrary and varied commands, as well as how to call the system shell from within a debugger session. You’ve seen how this can be useful in experimenting with and exploring the different possibilities which may be available, to arrive at the best coding solution for a particular set of circumstances.

In the next chapter we’ll take a look at debugging a plain CGI program locally, using the debugger inside a mod_perl enabled apache web server. Well also learn how to approach debugging a remote Perl program running on a different machine altogether.

Pp. 119-129

Debugging a CGI Program

Richard Foley; Andy Lester

In this chapter, we have learned how to approach debugging a Perl program when running on both local and remote machines. We’ve learned to do this with both a vanilla program, and under mod_perl using Apache::DB.

We have also explored several methods for diverting control of the debugger process to a remote host, via the DISPLAY environment variable, and remoteport debugger options. This frees us from the necessity of having to work on the same server as our program.

The next chapter explores the special cases of working with fork()ed Perl processes and threads.

Pp. 131-152

Perl Threads and Forked Processes

Richard Foley; Andy Lester

In this section you have learned how to work with Perl programs that use fork, were introduced to how Perl’s threading feature operates, and gained an appreciation for approaching the debugging of POE programs. When a Perl program forks, remember to use the appropriate xterm, or equivalent environment as required.

The next chapter will cover the debugger’s ability to dissect the regular expressions in your Perl program.

Pp. 153-173