in reply to Re: Debugging a module?
in thread Debugging a module?

If I do the $DB::single = 1 with a use statement, it breaks on the last line of the module -- which is '1;'. With a require statement, I get the results I mentioned easily. I haven't tried wrapping it in a BEGIN statement -- that's a good idea.

Replies are listed 'Best First'.
Re^3: Debugging a module?
by sfink (Deacon) on Apr 06, 2006 at 16:54 UTC
    Either your perl behaves very differently from mine, or I didn't describe it very well. If I use these two files:

    driver.pl

    use TestModule; print "I am exiting now.\n";

    TestModule.pm

    package TestModule; our $x = 0; $DB::single = 1; our $y = $x + 1; our $z = $y ** 3; sub blah { "blah!" } 1;

    ...and run perl -d driver.pl, the debugger immediately stops at the line our $y = $x + 1. Do you get different results?