Take a look at Devel::Trace
or Devel::ebug
.
Given this program named w.pl
:
#!/usr/bin/perl
use strict;
use warnings;
my $answer = 42;
if ($answer == 6 * 9) {
print "everything is running fine.
";
} else {
warn "there must be a bug somewhere...
";
}
You can use Devel::Trace
to watch the execution:
perl -d:Trace w.pl
Which produces the following output:
>> w.pl:6: my $answer = 42;
>> w.pl:8: if ($answer == 6 * 9) {
>> w.pl:11: warn "there must be a bug somewhere...
";
there must be a bug somewhere...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…