Dear monks

The perl debugger help on b says:

b $var Set breakpoint at first line of subroutine referenced by $var.
However when I try with the following program:
$ 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();
I got this behavior:
pp2@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>
The atttempt to set a breakpoint in the sub referenced by $x seems to be interpreted as a conditional breakpoint. Consequently the debugger never stops

What am I doing wrong here? (Perl version is v5.8.8)

Thanks

Casiano


In reply to b $var by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.