Hi,

I've been trying to put breakpoints in a Test::Class derivative's test method. The debugger lists the breakpoint, but never stops there. I've whittled this down, and I think it may be due to the attributes used to label test methods.

Is this a bug in the debugger? Either way, is there a workaround? I can't put a breakpoint in a file which isn't the current file, otherwise I could specify the right line to break on.

Consider this example program:

package X; use strict; use Attribute::Handlers; sub a : ATTR(SCALAR) { print "a\n"; } sub b { print "b\n"; } package main; X::a; X::b;
Then if I debug this I get the same sort of behaviour described above. i.e. The breakpoint on subroutine a (with the attribute) is ignored, and the debugger stops instead on subroutine b (with no attributes). Listing the breakpoints, the debugger seems to have put b's breakpoint on an unbreakable line:
$ perl -d dbtest.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. Attribute::Handlers::CODE(0x8322008)(/usr/share/perl/5.8/Attribute/Han +dlers.pm:206): 206: $global_phase++; DB<1> printf "Perl v%vd\n", $^V Perl v5.8.8 DB<2> b X::a DB<3> b X::b DB<4> L dbtest.pl: 5: sub a : ATTR(SCALAR) { break if (1) 10: print "b\n"; break if (1) DB<4> c a X::b(dbtest.pl:10): print "b\n"; DB<4>

In reply to bug in the debugger? breakpoints in subroutines ignored if attributes present by wu-lee

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.