Saturday, 6 March 2010
Useful VIM Abbreviations for debugging Perl
iab perlb print "<p>debug ::: $_ :: $' :: $` line ".__LINE__."\n";exit;
iab perlbb print "<p>debug ::: <C-R>a line ".__LINE__."\n";exit;
iab perlbd do{print "<p>debug :: <C-R>a line ".__LINE__."\n";exit} if $_ =~ /\w\w/i;
iab perld use Data::Dumper;$Data::Dumper::Pad="<br>";print Dumper @product_array;exit;
the <C-R>a automatically inserts whatever variable you had previously stored in register a
Dumper allows you to display arrays and hashes, you really should be using it.
Perl can be debugged using the Perl debugger eg > perl -d test.pl
or with the tk gui
perl -d:ptkdb test.pl
iab perlbb print "<p>debug ::: <C-R>a line ".__LINE__."\n";exit;
iab perlbd do{print "<p>debug :: <C-R>a line ".__LINE__."\n";exit} if $_ =~ /\w\w/i;
iab perld use Data::Dumper;$Data::Dumper::Pad="<br>";print Dumper @product_array;exit;
the <C-R>a automatically inserts whatever variable you had previously stored in register a
Dumper allows you to display arrays and hashes, you really should be using it.
Perl can be debugged using the Perl debugger eg > perl -d test.pl
or with the tk gui
perl -d:ptkdb test.pl
Labels: debugger, debugging, Perl, vim
Subscribe to Posts [Atom]
Post a Comment