esharris has asked for the wisdom of the Perl Monks concerning the following question:

I learned the rudiments of using h2xs to create a perl module for a perl library. (I.e., What's XS? There's C programs running? I.e., I'm driving the car, but I don't know how an internal combustion engine works.)

Suppose I am making a new perl module. I edit the ".t" file and do a "make test". (This tests the local modified version of the module, not the current version in the library.) Unfortunately, the test script crashes badly.

Is there a way to invoke the Perl debugger during a "make test" session?

If I do "perl -d t/*.t", I am running the test script using the current module in my library, not the local version I am modifying.

I could actually install the modified version and do a "perl -d /*.t", but that defeats the purpose of having a local environment to play with active modules. Furthermore, I'm replacing a working module with a non-working module.

Replies are listed 'Best First'.
Re: Debugging during make test
by perrin (Chancellor) on Dec 09, 2005 at 19:37 UTC
    Just set this environment variable before running 'make test': HARNESS_PERL_SWITCHES=-d
Re: Debugging during make test
by xdg (Monsignor) on Dec 09, 2005 at 19:19 UTC
    Is there a way to invoke the Perl debugger during a "make test" session?

    This will generally do what you're asking for:

    prove -b -d -v t/001.some_test.t

    Update: Misremembered what I actually do. More like this:

    perl -Mblib -d t/001.some_test.t

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Debugging during make test
by BUU (Prior) on Dec 09, 2005 at 19:19 UTC
    When you do make test it adds the the folders containing the local version of the module to the front of your @INC. When you run just perl it doesn't have these modifications any more. See lib and the -M switch.