Error Handling and Debugging

When you write programs, you’ll encounter problems, and it’s good to know how to get information that can help you pinpoint and resolve those problems. If you don’t do something about error checking, your scripts will fail and you won’t know why. This section discusses diagnostic and debugging techniques that will be useful to you as you develop MySQL scripts.

One technique that we’ve already seen is to use the -w option on the #! line that begins your script:

#! /usr/bin/perl -w 

This puts Perl in warning mode, causing it to issue messages when it finds something about the script that doesn’t look quite right. You may want to turn on -w while you’re developing a script, and then disable it when you put the script ...

Get MySQL and Perl for the Web now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.