[Mastering-perl] Debugging Perl

Florian Merges fmerges at cpan.org
Fri Dec 22 06:40:25 EST 2006


Hi,

Chapter: Debugging Perl
==================

Section: Before You Waste Too Much Time
--------------------------------------------------------------

It's the common mistakes that seem to be the hardest ====> mistake


Learn from the master: don't discount strict or warnings for even small
programs.

====> or warnings, even for small programs


Section: Program tracing
------------------------------------

I put a line of hyphens before and after the cluck() to set apart its output
to it it easier to read:

====> to it, so it's easier to read.


Section: Safely changing modules
--------------------------------------------------

I then create the directories I need to store the copied module, the copy
the module.

Could be that this phrase can be changed a bit, to make it more clear...


Section: Wrapping subroutines
---------------------------------------------

The following is a replacement for the last example of using Hook::LexWrap


use strict;
use warnings;

use Hook::LexWrap;

my ($n, $m) = @ARGV;

{
no warnings 'uninitialized';
wrap add,
pre => sub {
print "I got the arguments: [@_]\n";
$_[-1] = "11";
},
post => sub { print "The return value is going to be $_[-1]\n" }
;
}
print "The sum of $n and $m is " . add( $n, $m ) . "\n";

sub add {
my ($n, $m) = @_;

my $sum = $n + $m;

return $sum;
}


And I run it with values 4 and 5 to see what is happening...

$ perl t.pl 4 5
I got the arguments: [4 5 ]
The sum of 4 and 5 is 11

Section: Alternate Debuggers
-------------------------------------------

SubSection: Devel::ptkdb
-------------------------------------

At the start of the program, I'm at the start of the program and nothing
has run yet.

===> debugger program (or something like this...)

SubSection: Devel::ebug
------------------------------------

, but even as that it's very impressive and can serve ====> that,
it's


Section: Other debuggers ====> Why not something like Miscelanea,
because EPIC+Eclipse, and Komodo are
-------------------------------------- Development
Environments that include a debugger...

Section: Further reading
-----------------------------------

I would add also to this list the book "Perl Debugger Pocket Reference" I
think it contains all you should need and know about the included perl
debugger...



Regards,

Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://five.pairlist.net/pipermail/mastering-perl/attachments/20061222/9f80a333/attachment.html


More information about the Mastering-perl mailing list