Chapter 4
Debugging
Perl comes with a command line debugger similar to the popular gdb C debugger.
If you've never used the Perl debugger before, you should look at the perldebug
documentation to get started. To run the Perl debugger on a single test.pl test
script, use the command make testdb:
$ make testdb
PERL_DL_NONLAZY=1 /usr/local/bin/perl d Iblib/arch Iblib/lib \
I/usr/local/lib/perl5/5.6.1/i686 linux I/usr/local/lib/perl5/5.6.1 test.pl
Default die handler restored.
Loading DB routines from perl5db.pl version 1.07
Editor support available.
Enter h or h h for help, or man perldebug for more help.
1..1
main::(test.pl:4): ok(1); # If we made it this far, we re ok.
DB<1>
However, if you're using a t directory of test scripts, then a simple make testdb won't
work. This is because the debugger will only work on a single script. To use the
debugger on a single .t file, include the option TEST_FILE. For example, to run
t/02basic.t under the debugger, you would use the following command:
make testdb TEST_FILE=t/02basic.t
Multimodule Distributions
A module distribution can contain more than one module file. A common use for
packaging multiple files in a distribution is to install a family of modules in a
common namespace. For example, the HTML::Template::JIT
15
module distribution
contains the three modules HTML::Template::JIT, HTML::Template::JIT::Compiler,
and HTML::Template::JIT::Base. The main module file, JIT.pm, is placed where you
would expect it in the module distribution directory. The other two, Compiler.pm
and Base.pm, are placed in a directory called JIT. Makefile.PL automatically finds
the two submodules and installs them along with JIT.pm.
15. HTML::Template::JIT provides a just in time compiler for HTML::Template. The module was
written by myself, Sam Tregar, and is available on CPAN.
116
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved