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

I encountered a very odd situation at work today. I was trying to debug a script (using 'perl -d /path/to/script.pl arg1 arg2 ...), and for reasons that baffle me the -d flag was apparently ignored. The script ran as if it simply wasn't there. I looked it over, looking for anything that seemed like it might conceivably trip up the debugger and was coming up with nothing. I checked earlier versions of the script, and they all entered normal debugging mode as expected.

Finally, I decided to simply start commenting out changes I'd made and keep trying until it worked. This strategy was useful, as the first line I commented out and tested turned out to be the apparent cause of the problem.

The line in question was simply a 'use' statement importing a module (part of my employer's site perl). I examined the module being imported and found nothing at all odd. I only needed a single, small subroutine from it, so I solved the problem (in the most temporary sense) by copying/pasting it into the script and calling it directly.

The module being called does work as expected regardless of the debugger strangeness. I'd love to post code here, but two things prevent me:

  1. it is the property of my employer, and I have not asked permission to post it publicly
  2. the imported module is a few hundred lines long, I think, and the script calling it is over 1800 lines; I can't imagine it would be helpful or advisable to post such voluminous code here for analysis.
Besides, as I mentioned, I've found a temporary work-around.

So my question is this. Has anyone else seen behavior like this out of the debugger? I've never heard of anything like this, and couldn't find any results that seemed relevant from google, perl.com, or here. It may not be relevant, but I believe the perl version is 5.8.8 running on Redhat/Fedora (not certain of version, but probably FC6).

Relevant links and anecdotes would be most appreciated.

Thanks,

jackofnotrades

Replies are listed 'Best First'.
Re: Debugger weirdness (DB::)
by tye (Sage) on Jan 24, 2008 at 05:43 UTC

    Look for places (in the troublesome module) that mention DB:: ? For example, $DB::single= 0; might cause the debugger to not stop and prompt for commands, making it less obvious that the debugger was invoked at all. There are likely other tricks you can do with the DB package that would make the debugger even less visible. You might find answers in perldebug or perldebguts or even perldebtut.

    - tye        

Re: Debugger weirdness
by ysth (Canon) on Jan 24, 2008 at 09:47 UTC
    Make and use a copy of the problematic module under a different name, then start stripping stuff out of it until you can identify what causes the problem.