Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The perl debugger help on b says:
However when I try with the following program:b $var Set breakpoint at first line of subroutine referenced by $var.
I got this behavior:$ cat namevsref.pl use warnings; use strict; my $time = 1; my $x = sub { print "Inside sub. time = ".($time++)."\n"; }; no strict 'refs'; *{"tutu"} = $x; $x->(); tutu();
The atttempt to set a breakpoint in the sub referenced by $x seems to be interpreted as a conditional breakpoint. Consequently the debugger never stopspp2@nereida:~/src/perl/testing$ perl -wd namevsref.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::(namevsref.pl:4): my $time = 1; DB<1> l 1,14 1: use warnings; 2: use strict; 3 4==> my $time = 1; 5 6 my $x = sub { 7: print "Inside sub. time = ".($time++)."\n"; 8: }; 9 10: no strict 'refs'; 11: *{"tutu"} = $x; 12 13: $x->(); 14: tutu(); DB<2> c 11 main::(namevsref.pl:11): *{"tutu"} = $x; DB<3> x $x 0 CODE(0x825a074) -> &main::__ANON__[namevsref.pl:8] in namevsref.pl:6-8 DB<4> b $x DB<5> L namevsref.pl: 11: *{"tutu"} = $x; break if ($x) DB<5> c Inside sub. time = 1 Inside sub. time = 2 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<5>
What am I doing wrong here? (Perl version is v5.8.8)
Thanks
Casiano
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: b $var
by jethro (Monsignor) on Jun 17, 2008 at 12:52 UTC | |
by radiantmatrix (Parson) on Jun 17, 2008 at 18:15 UTC | |
Re: b $var
by ww (Archbishop) on Jun 17, 2008 at 12:39 UTC | |
Re: b $var
by casiano (Pilgrim) on Jun 17, 2008 at 13:03 UTC | |
Re: b $var
by casiano (Pilgrim) on Jun 17, 2008 at 13:09 UTC |