in reply to Debugging a module?

How about not useing it, but require instead? Something like this:
#!/usr/bin/perl require Hairy::Module; # optionally, also import its symbols: # import Hairy::Module;
That would allow you to step through the code, since it's done at runtime instead of compile time.

Replies are listed 'Best First'.
Re^2: Debugging a module?
by dstar (Scribe) on Apr 06, 2006 at 01:10 UTC
    I should have mentioned that I tried that, and _weird_ things happened. For example, I couldn't set a breakpoint at _any_ line; no matter what line I tried, I got 'line xxx not breakable'. I'm assuming that there's some trick needed that I don't know about.
      In the debugger, you first have to point to the module file with f Module.pm, then you can set breakpoints. (f also takes regexen, so you don't have to be too particular unless there's an ambiguity.)

      On the other hand, you should be able to step into the require, though I've not tried it myself. (I have stepped into an eval, which would seem to be more difficult for a debugger to manage.)

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        Aha. I'll try that, and see how it works.
      Good question, and I don't know. Since you're the maintainer, I'd forget about the debugger for a bit, and try adding some warn Dumper($some_var) in places.

      Without seeing the code, this is a long shot, but maybe you'd be helped by wrapping the nasty code in a sub of your own. That might kickstart the debugger.