Perl の debbugging flag PL_debug を制御することと、実行時フラッグ -D を制御することについて。
Perl5 のソースをよんでると DEBUG_M() とかそういうマクロがときどき目にはいる。
この /DEBUG_./ な関数は PL_debug っていうフラッグのオンオフによって出力が制御される関数である。これは -DDEBUGGING でコンパイルされているときのみ利用可能となる。
たとえば DEBUG_M() のデバッグ出力を見るには
perl -DM -e '[]~~[]'
とかすればよろしい。
"-D" でなにが指定できるかについては以下のようにすれば、一覧が見える。
perl -D'' -e0
この -D のオプションはバージョンによって結構ちがっていて、5.10.1 と blead の間でも以下のような差異がある。
--- st 2010-02-14 22:22:04.000000000 +0900
+++ blead 2010-02-14 22:22:21.000000000 +0900
@@ -5,7 +5,7 @@
t Trace execution
o Method and overloading resolution
c String/numeric conversions
- P Print profiling info, preprocessor command for -P, source file input state
+ P Print profiling info, source file input state
m Memory and SV allocation
f Format processing
r Regular expression parsing and execution
@@ -14,7 +14,6 @@
H Hash dump -- usurps values()
X Scratchpad allocation
D Cleaning up
- S Thread synchronization
T Tokenising
R Include reference counts of dumped variables (eg when using -Ds)
J Do not s,t,P-debug (Jump over) opcodes within package DB
@@ -22,3 +21,5 @@
C Copy On Write
A Consistency checks on internal structures
q quiet - currently only suppresses the 'EXECUTING' message
+ M trace smart match resolution
+ B dump suBroutine definitions, including special Blocks like BEGIN
(どうでもいいけど、s/suBroutine/subroutine/ ですね)
Published: 2010-02-14(Sun) 13:25