एक बोझिल कामकाज आपके कोड में लेबल और सशर्त goto
बयान जोड़ने के लिए होगा। लेकिन इस सुविधा के अनुकरण के लिए आप कितनी बुरी तरह से इस पर निर्भर करते हैं, यह इसके लायक हो सकता है।
POINT1: $GOTO=""; # $GOTO is our fake variable that we only set from the debugger
($a,$b,$c)=(1,2,3);
POINT2: $GOTO="";
if ($a < $b) {
goto $GOTO if $GOTO;
if ($a > $c) {
goto $GOTO if $GOTO;
print "foo\n";
} else {
goto $GOTO if $GOTO;
print "bar\n";
}
goto $GOTO if $GOTO;
} else {
goto $GOTO if $GOTO;
print "nothing\n";
goto $GOTO if $GOTO;
}
नमूना डिबगिंग सत्र:
$ perl -d debuggoto.pl
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(debuggoto.pl:1): POINT1: $GOTO=""; # $GOTO is our fake variable that we only set from the debugger
DB<1> n
main::(debuggoto.pl:2): ($a,$b,$c)=(1,2,3);
DB<1>
main::(debuggoto.pl:3): POINT2: $GOTO="";
DB<1>
main::(debuggoto.pl:4): if ($a < $b) {
DB<1>
main::(debuggoto.pl:5): goto $GOTO if $GOTO;
DB<1>
main::(debuggoto.pl:6): if ($a > $c) {
DB<1>
main::(debuggoto.pl:10): goto $GOTO if $GOTO;
DB<1>
main::(debuggoto.pl:11): print "bar\n";
DB<1>
bar
main::(debuggoto.pl:13): goto $GOTO if $GOTO;
DB<1> $GOTO="POINT2"
DB<2> n
main::(debuggoto.pl:3): POINT2: $GOTO="";
DB<2> $c=0
DB<3> n
main::(debuggoto.pl:4): if ($a < $b) {
DB<3>
main::(debuggoto.pl:5): goto $GOTO if $GOTO;
DB<3>
main::(debuggoto.pl:6): if ($a > $c) {
DB<3>
main::(debuggoto.pl:7): goto $GOTO if $GOTO;
DB<3>
main::(debuggoto.pl:8): print "foo\n";
DB<3>
foo
main::(debuggoto.pl:13): goto $GOTO if $GOTO;
DB<3>
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<3>
Use `q' to quit or `R' to restart. `h q' for details.
DB<3>
मुझे आश्चर्य है कि अगर यह एक डिबगर इस विचार का उपयोग करता है के निर्माण के लिए संभव हो जाएगा।
मैं कल्पना करने की कोशिश कर रहा हूं कि आप क्या करना चाहते हैं, लेकिन नहीं कर सकते। मैं इसके बजाय अनुमान लगाऊंगा। बी :: यूटिल या बी :: हुक :: ओपी :: चेक सहायक हो सकता है; ऑप्ट्री संपादित करें और अगले ऑप को उस पर सेट करें जिसे आप निष्पादित करना चाहते हैं; या निष्पादित होने पर एक सेशन और रन कोड को हुक करें। एक कस्टम रनलोप भी सहायक हो सकता है। लेकिन मूल रूप से, आप यहां पर हैं; समय यात्रा perl5db की एक विशेषता नहीं है। – jrockway
समय यात्रा नहीं है। मैं मनमाने ढंग से निष्पादन समय के बिंदु को किसी दिए गए स्थान पर सेट करना चाहता हूं, * ऐसा करने की संवेदना के लिए * बिना किसी सम्मान के *। –
कस्टम रनलोप तब अच्छा लगता है। आप जो करना चाहते हैं वह बहुत अजीब है, हालांकि, यह लागू नहीं किया गया है। – jrockway