worik has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $x = 3; for(1..3){ my $y = $x; $y++; $x -= $y; }
The above little programme, if I put an acton on line 6 ($y++) the action occurs at line 6, line 7 then at line 5 where it is invalid ($y not defined)
To illustrate here is my session in the debugger...
DB<3> a 6 print ("\$y $y\n") DB<4> n DB<4> DB<4> $y 3 DB<4> $y 4 DB<4> Use of uninitialized value $y in concatenation (.) or string at (eval +9)[/usr/share/perl/5.18/perl5db.pl:732] line 1. at (eval 9)[/usr/share/perl/5.18/perl5db.pl:732] line 1. eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;pack +age main; print ("\\$y $y\\n"); ' called at /usr/share/perl/5.18/perl5db.pl line 732 DB::eval called at /usr/share/perl/5.18/perl5db.pl line 2661 DB::DB called at test.pl line 5 $y DB<4>
Clearly I misunderstand the manual. How do I do an action so it happens on only one line?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Debugger actions: On which lines?
by james28909 (Deacon) on Aug 18, 2015 at 05:23 UTC | |
by worik (Sexton) on Aug 18, 2015 at 05:29 UTC | |
by 1nickt (Canon) on Aug 18, 2015 at 05:40 UTC | |
by james28909 (Deacon) on Aug 18, 2015 at 05:59 UTC | |
by 1nickt (Canon) on Aug 18, 2015 at 06:20 UTC | |
| |
by james28909 (Deacon) on Aug 18, 2015 at 05:32 UTC | |
by worik (Sexton) on Aug 18, 2015 at 05:38 UTC |