Here's a first draft, incomplete implementation a possible response to my notion (YMMV) that Perl's CLI debugger is intimidating to novices (well, it was to me... for several years).
IOW, here's a simple-minded, do-nothing, little script that invites the user to explore some debugger commands in circumstances in which s/he need not fear will be tantamount to rm rf (or del *.* /s, if 'doze in the learner's OS flavor).
My hope is that the minimal set of operations in the script give a hint of (or maybe "are extensive enough for a start?") the range of debugger options/commands which the user would be well advised to learn.
The specific RFC follows the code:
#!/usr/bin/perl use 5.014; # modify to match your "perl -v" unless (@ARGV) { say "debugger practice; on restart, 1st arg must be a number\n"; exit; } say "Explore debugger commands w expr W expr b Ln|Event B Ln|Event (et +c incl l v s n)\n"; my ($var1, $var2, $var3); my @arr = qw (a b c d e f g); sub testable { # useless uninformative comment my $subvar1 = shift; say "\t In sub testable, \$var1: $var1"; my $subvar2 = shift; say "\t AS PASSED TO SUB, \$var2: $var2"; $subvar2 *= 5; say "\t In sub testable, \$subvar2: $subvar2"; my $subvar_rand_int = int(rand($subvar2)); say "\t In sub, \$subvar_rand_int is: $subvar_rand_int."; return $subvar_rand_int; # to $result } chomp($var1 = shift); $var2 = int(3*$var1); say "Pre_sub, \$var1: $var1 and \$var2: $var2"; push my @pass_to_sub,$var1; push @pass_to_sub,$var2; my $result = testable(@pass_to_sub); say "Back from sub with \$result: $result"; # another comment for exploration of the deugger for $_(@arr) { $_ .= "_foo"; say "$_ " x $result; say "\n"; }
So, the question: are this notion and this approach worth pursuing, further, with additional scripts focusing on packages, OO, modules, etc... If so, where should that focus begin?
Or should one, IYO, focus instead on getting noobs to use some of the available (often for $$$) GUI debuggers/other debuggers?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RFC: debugger_trainer
by roboticus (Chancellor) on Dec 24, 2012 at 22:40 UTC | |
by ww (Archbishop) on Dec 25, 2012 at 01:14 UTC | |
by roboticus (Chancellor) on Dec 25, 2012 at 03:15 UTC | |
Re: RFC: debugger_trainer
by Anonymous Monk on Dec 25, 2012 at 05:24 UTC | |
Re: RFC: debugger_trainer
by davies (Prior) on Dec 25, 2012 at 12:14 UTC | |
by ww (Archbishop) on Dec 25, 2012 at 13:21 UTC | |
Re: RFC: debugger_trainer
by lwicks (Friar) on Dec 28, 2012 at 11:03 UTC |