[problem]
You have an error in your Perl script and want to debug it.
[/problem]
[solution]
Debugging in Perl is very extensive, this demo is very basic! 🙂 Check the reference for further instruction.
You can manipulate PERLDB_OPTS variable, to force some debugging – then just pass through a -d option to your perl script.
Also system debugging is at the reference tab.
[/solution]
[example]
export PERLDB_OPTS="NonStop frame=1 AutoTrace"
perl -d -pi'.bak' -e 's/unix/UNIX/g' *htm*
Output:
Package -e.
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
1: s/unix/UNIX/g
0: BEGIN { require 'perl5db.pl' };LINE: while () {
entering Config::DESTROY
entering IO::Handle::DESTROY
entering IO::Handle::DESTROY
[/example]
[reference]
[tags]Debugging Perl, Perl Coding School[/tags]
[/reference]
If you have found my website useful, please consider buying me a coffee below 😉