2016-08-25 18 views
3

私はデバッガでプロンプトを表示する前に、semicomplex構造体を出力させたいと思っています。それを表示する最善の方法は、xコマンドを使用することですが、コマンドはその名前では使用できないか、おそらくスコープに含まれていません。perlデバッガの<アクション内で `x`コマンドを実行するには?

これはどのようにして達成できますか?

答えて

9

perldebug< [command]のマニュアルを参照してください:

< [コマンド]すべてのデバッガープロンプトの前に実行するアクション(Perlのコマンド)を設定し

xはPerlコマンドではありません。あなたは{ [command]をしたい:

{[コマンド]すべてのデバッガープロンプトの前に発生するアクション(デバッガコマンド)を設定し

。例えば

:あるいは

$ perl -de'$foo = { foo => "bar" }; 
      print $foo' 

Loading DB routines from perl5db.pl version 1.37 
Editor support available. 

Enter h or 'h h' for help, or 'man perldebug' for more help. 

main::(-e:1): $foo = { foo => "bar" }; 
    DB<1> { x $foo 
    DB<2> n 
main::(-e:2): print $foo 
auto(-1) DB<2> x $foo 
0 HASH(0x22af2c8) 
    'foo' => 'bar' 

、(例えばData::DumperData::DumpData::Printer)お気に入りダンパモジュールを使用する:

$ perl -de'$foo = { foo => "bar" }; 
      print $foo' 

Loading DB routines from perl5db.pl version 1.37 
Editor support available. 

Enter h or 'h h' for help, or 'man perldebug' for more help. 

main::(-e:1): $foo = { foo => "bar" }; 
    DB<1> use Data::Dumper 

    DB<2> < print Dumper $foo 
    DB<3> n 
main::(-e:2): print $foo 
$VAR1 = { 
      'foo' => 'bar' 
     }; 
+0

ああ、 '' {コマンドを逃しました。ありがとう。 – Adrian

関連する問題