Running and Debugging Perl
By now, we've essentially covered the whole of the core Perl language. We've yet to see how we can use pre-packaged modules to accomplish a great many common tasks, including applying Perl to networking, CGI and database manipulation. But right now, we've finished as much of the language as you'll need to know for pretty much everything you'll want to do with Perl. Congratulations for getting this far!
You should also be getting used to analyzing the problem you want to solve, breaking it down into component parts, and thinking about how to explain those parts to the computer in a language it can understand. That's not all, however.
Everyone makes mistakes. It's a simple fact of life, and programming is just the same. When you write programs, you will make mistakes. As we mentioned in the first chapter, the name for a mistake in programming is a bug, and the process of removing bugs is called debugging. After breaking down your ideas and writing the code, you'll come to the next two phases of software development: testing and debugging.
In this chapter, we'll see how Perl helps us with these stages. In particular, we'll cover the following areas:
Error Messages How the perl interpreter tells you you've used the language incorrectly.
Diagnostic Modules What modules can help us isolate and understand problems with our code.
Perl Command Line Switches Creating test programs using the perl command line.
Debugging Techniques and the Perl Debugger How to remove the problems that we've found.
By the end of this chapter, you should be able to recognize, diagnose, and hopefully fix any programming errors you make. We'll also look at how to construct test cases and quick one-line programs on the perl command line.