On Tue Sep 28 01:07:49 2010, hexcoder wrote: > Greetings, > > > But it should be evaluated _once_ instead of thrice in your test script > because control reaches line 11 only once. > The definition of the 'a' command is according to the debugger book > 'Pro Perl Debugging' from Richard Foley and Andy Lester > like this (on page 241): > "Create an action to run the supplied perl expression each time the code > on the given line number is about to be executed." > > So the evaluation needs to take the line number into account, which it > currently does not. > Once the action is activated, it is performed on each line upto the end > of the scope (at least). > > Note: this is not related to perlbug #71806 'perldb does not setup > %dbline with shebang option -d', > because the behaviour is present also without shebang option -d. > > I don’ think it has to do with the end of the program. This script > > displays the message three times. I’ve never used the debugger before, > > so I don’t know whether this is correct. But it seems to me that $action > > needs to be cleared elsewhere in the debugger. > > > > BEGIN { > > push @DB::typeahead, 'a 11 print "thrext\n"', 'c 8', ('s')x3, 'q'; > > $DB::single = 0; > > } > > use strict; use warnings; > > > > greet('Hello'); > > > > sub greet > > { > > my $arg = shift; > > print "$arg\n"; > > return; > > } > > __END__ > > > > > > > > > > I propose this example (see attachment), which uses a lexical variable > from the inner scope: > ==== quote ======== > BEGIN { > push @DB::typeahead, 'a 12 print "${arg}__${arg}\n"', ('s')x4, 'q'; > $DB::single = 0; > } > use strict; use warnings; > > greet('Hello'); # first stop in debugger > > sub greet > { > my $arg = shift; > $arg = ''; # line 12 > return; > } > ===== end quote ======= > > Thanks, hexcoder > Discussion of this issue petered out about a year-and-a-half ago. Is there anyone familiar with debugger issues who could review this RT? Thank you very much. Jim Keenan --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=71678Thread Next