私の目標は、以下のsample.pl
スクリプトをデバッグ(ステップバイステップ)することです。Perlトレースから変数の値を見るにはどうすればいいですか?
問題:変数($ top_number、$ x、$ total)の実際の値が得られません。
私の質問:トレース出力から($ top_number、$ x、$ total) の実数の値を見るにはどうすればよいですか?
perl -d:Trace
で変更する必要がある番号は、$ top_number、$ x、$ totalではありません。トレース出力から
例:
[[email protected] /tmp]# perl -d:Trace ./sample.pl
>> ./sampl.pl:9: $top_number = 100;
>> ./sampl.pl:10: $x = 1;
>> ./sampl.pl:11: $total = 0;
>> ./sampl.pl:12: while ($x <= $top_number) {
>> ./sampl.pl:13: $total = $total + $x; # short form: $total += $x;
>> ./sampl.pl:14: $x += 1; # do you follow this short form?
>> ./sampl.pl:13: $total = $total + $x; # short form: $total += $x;
>> ./sampl.pl:14: $x += 1; # do you follow this short form?
>> ./sampl.pl:13: $total = $total + $x; # short form: $total += $x;
>> ./sampl.pl:14: $x += 1; # do you follow this short form?
.
.
[[email protected] /tmp]#more sample.pl script
#!/usr/bin/perl
$top_number = 100;
$x = 1;
$total = 0;
while ($x <= $top_number) {
$total = $total + $x; # short form: $total += $x;
$x += 1; # do you follow this short form?
}
print "The total from 1 to $top_number is $total\n";
わずか数日前に 'Devel :: DumpTrace'がリリースされました。穏やかになり、見つけたバグを報告してください。 :-) – mob
@Mobは心配しないでください – jon
@ hiもう一度エラーが出ます:perl -d:DumpTrace ./sampl.pl @INCにPadWalker.pmが見つかりませんか?なぜ – jon