Perl - Debugging

perl

Debugging and Profiling mod_perl Applications
DTrace and Perl (DTrace originated on Solaris platform, ported to Mac, and possibly Linux). There are a couple of videos available on YouTube.com

How can we debug a Perl file?

Perl comes with its own debugger:

perl -D test.pl
perl -d file.pl
perl -d:ptkdb buggy.pl buggy.pl (See Devel::ptkdb)
valgrind --leak-check=yes --trace-children=yes perl whatever.pl

What is EPIC?

EPIC is a plugin for Eclipse, capable of debugging CGI application. To debug CGI application, EPIC acts as a proxy between the web server and the client. This enables it to control and monitor the execution of the script, even though technically the script is being accessed through the web server. You'll need to put a copy the scripts onto the server (you can use the Export function of Eclipse). You will also need to configure the name of a 'startup' file to be used when debugging. This file will be returned when the web server is first accessed and it should contain a link to the script or the form that uses the script. EPIC comes with a built-in web browser. EPIC also has a regular expression debugger. tutorial

Can we use Komodo to debug mod_perl?

Komodo from ActiveState can debug mod_perl.

Can we debug mod_perl by inserting 'PerlRequire …./perl5db.pl' into httpd.conf?

Possibly. I haven't tried this yet.

How can we profile a Perl program?

To profile you Perl program, just type:

perl -d:DProf myprogram.pl

When the script terminates the profiler will dump the profile information to a file called tmon.out. A tool like dprofpp can be used to intepret the information in the profile.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License