kidongrok has asked for the wisdom of the Perl Monks concerning the following question:
Ive also tried -d on the scripts shebang line, with autorun setup. iirc this was a bit better, but I dont recall ever getting it to just run without at least a "c\n" at the prompt.
Arguably this can be done currently with a concoction of stuff starting with .perl5db.pl, but having the ability to put it all in-file would increase awareness and use (just like POD did), and engender more sophisticated stuff, like setting up a series of conditional breakpoints specific to the code, and providing some doc of how a problem was narrowed, isolated, and squashed.
strawman:
use DB (init => q{
b load Foo::DelayedLoad;
b Foo::bar @_>50 # catch long arglist
# trap bad args to setprops: $me,%props =@_
b Foo::setProps !(@_ % 2);
# etc...
},
init_bug_201 => q{ doc only, ignored so it can
be preserved unaltered }
);
or can this all be done currently ?
or can the artfullness thats required be explored here so that it can be copied by more pedestrian practishoners ( parishoners ?) such as myself ?
OK heres some code that kinda works:
#!/usr/local/bin/perl -d
use Getopt::Std;
BEGIN {
DB::parse_options("NonStop=1"); # LineInfo=db.out AutoTrace");
#$DB::single = 0;
$DB::inhibit_exit = 0;
$DB::lastcmd = 'c'; # I think this fixes the "c\n"
}
getopts('di') or die "bad args";
if ($opt_d) {
print "hello 1\n";
$DB::single = 1;
}
if ($opt_i) {
print "hello 2\n";
$DB::single = 2;
}
print "hello world\n";
perl-play$ selfdebug.pl -d
Loading DB routines from perl5db.pl version 1.23
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
NonStop = '1'
hello 1
main::(./selfdebug.pl:20): if ($opt_i) {
DB<1> q
perl-play$ selfdebug.pl
Loading DB routines from perl5db.pl version 1.23
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
NonStop = '1'
hello world
perl-play$
|
|---|