At the risk of beating an already dead horse, since setting a breakpoint on
a "use" statement is likely to continue to cause confusions like this, I've
added a hack in Devel::Trepan to see if the line that a breakpoint has been
set at starts with the regexp /^\s*use\s+/. If so, a warning is issued
The breakpoint is still set - it is just a warning. There are many ways
that this heuristic can fail. For example setting a breakpoint on a line
use English; $x = 3;
may "skip" the "use" and still stop on the assignment statement.
On Mon, Dec 19, 2011 at 12:20 AM, Rocky Bernstein <ro...@cpan.org> wrote:
> A while back on Tue, 31 May 2011 18:20:51 -0700 Conor wrote:
> Not exactly a high priority bug, but I found that if you set a breakpoint
>> a line where a 'use' statement exists, the breakpoint will show as set and
>> the debugger won't complain:
>> $ perl -d breakpoint-bug.pl
>> Loading DB routines from perl5db.pl version 1.32
>> Editor support available.
>> Enter h or `h h' for help, or `man perldebug' for more help.
>> 7: print "hello!\n";
>> DB<1> b 9
>> DB<2> v
>> 4: use strict;
>> 5: use warnings;
>> 7==> print "hello!\n";
>> 9:b use Data::Dumper;
>> 11: print "goodbye!\n";
>> 13: exit 0;
>> But, if you 'c' from line 7, you skip over the breakpoint on 9 as if it
>> wasn't there. It isn't a huge problem (and I really should keep all of my
>> 'use' statements at the beginning of the script), but I figured it was
>> a mention.
>> I couldn't figure out how to actually file a bug at http://rt.perl.organd
>> http://search.cpan.org/~jesse/perl-5.14.0/lib/perl5db.pl didn't have the
>> usual 'View/Report Bugs' that most modules have. I'm happy to file a bug
>> someone could point me in the right direction.
> I just looked at this. I don't think there is a bug here.
> The code has a "use" statement. A breakpoint is set on that which the
> reporter doesn't feel is respected.
> However, recall that "use" happens at compile time and this occurs before
> the first stop you see in the debugger.
> To verify this when I issued:
> $Data::Dumper::VERSION from Devel::Trepan stopped at line 7, I got a
> version string, e.g. '2.124'. (in perl5db use "p $Data::Dumper::VERSION"
> Change the "use" to a "require" which then changes the semantics, and
> you'll things will work as you seem to expect it to would above.
> So in sum, I don't think there is a bug. Just perhaps confusion about how
> execution works -- which I admit is confusing.