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

This is a general question because I have run into this with this and other public modules. How the heck do you debug problems with someone else's module. Do you make a copy and start debugging that?

To get specific to the topic of the subject line, I am having a deep gnarly problem with DBI. Can anyone offer any wisdom? Thanks.

The error message, just as a for example:

DBD::Proxy::st execute failed: Server returned error: Failed to execute method CallMethod: Can't bind unknown placeholder '2' at /u/ucc/staff/dba/lib/perl5/site_perl/DBI/ProxyServer.pm line 301.

DBI version:  DBI::VERSION = "1.12"

...and part of my perl -V output (don't yell at me):

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration: Platform: osname=solaris, osvers=2.6, archname=sun4-solaris uname='sunos deckard.cc.rochester.edu 5.6 generic_105181-06 sun4u +sparc sunw,ultra-5_10 '
-- -kechari "I'm continually AMAZED at th'breathtaking effects of WIND EROSION!!" (Zippy)

Replies are listed 'Best First'.
Re: DBI/module debugging?
by tommyw (Hermit) on May 29, 2002 at 16:48 UTC

    Can you run the program (for debugging purposes) without DBD::Proxy? Hopefully a real driver will give you a more informative error message (but I won't swear to it).

    Otherwise, use the -d flag to get into the debugger, set a breakpoint at line 301 of the ProxyServer module, and run as normal. When the breakpoint gets hit, check your call stack.

    --
    Tommy
    Too stupid to live.
    Too stubborn to die.

Re: DBI/module debugging?
by Jenda (Abbot) on May 29, 2002 at 20:52 UTC

    I know I should not but ... sometimes I even do add debug prints into other peoples modules (on my development machine). But I do mark them and delete them afterwards.

    And I do look inside whenever I get a message like this and try to understand what the heck is going on down there. Besides I can learn something reading other people's code.

    I believe this helps a lot, imagine you COULDN'T go and look at&modify that library. Imagine you did not know what went wrong inside and couldn't find out.

    Anyway I do not use the commandline debuger, I use ptkdb instead. Maybe it doesn't allow me to set a break point that's triggered only each 7th time and only if there is a process with ID 15764 on the machine, but it gives me more context. A matter of personal preference of course.

    To get back to DBI ... is there any chance you call an ->execute() with too many params? Could you change the die() on line 301 of DBI/ProxyServer.pm to Carp::confess(), to see what command in your script caused the problem?

      Jenda

Re: DBI/module debugging?
by alien_life_form (Pilgrim) on May 29, 2002 at 16:23 UTC
    Greetings,

    So what's preventing you to just fire up perl -d <your script> and go from there? You can go inside DBI.pm and debug it just fine.
    And yes, your perl is old and mouldy. It needs updating.(*)
    Cheers,
    alf

    (*)From an old .aiff file that once shipped with SGIs...


    You can't have everything: where would you put it?
      So what's preventing you to just fire up perl -d <your script> and go from there? You can go inside DBI.pm and debug it just fine.

      It is not that easy. Parts of DBI are writen in C so you just cannot use perl debugger to "go inside" them. And even if DBI were pure Perl it is quite complex software (i.e. debuging it with perl -d can be PITA especially for newbie).

      Maybe better (easier) method is enabling DBI debug trace. See DBI documentation for description of method trace and section DEBUGGING.

      --
      Ilya Martynov (http://martynov.org/)

Re: DBI/module debugging?
by perrin (Chancellor) on May 29, 2002 at 20:48 UTC
    Your problem isn't in DBI, it's in DBI::ProxyServer, which is a pure perl module. I would strongly recommend that you do anything in your power to avoid DBI::ProxyServer, since it's slow and limited, but if you have to use you can debug it with normal perl debugging tools.
Re: DBI/module debugging?
by kechari (Novice) on Jun 24, 2002 at 01:51 UTC

    Thanks for the comments. I did try perl debugger, but it sure buggers me. No hints detected down in that dirty dungeon. Of course, during my whole career of sysadmin/DBA who programs a bit, I have only once found that sort of debugger to like tell me anything useful, and that one time it was C. Guess I'll never be a real programmer.

    I have barely touched the problem since then cuz it only makes the monthly run break, guess I better get busy. Anyway, I'm thinking now it is a subtle database corruption because I do have a lock problem sitting in the database.

    So Perl & DBI are not apparently the problem after all except in that the error message is well, like most error messages, totally unhelpful.

    That perl and TK debugger looks really interesting, Thanks!

    -- -ken rich "I'm continually AMAZED at th'breathtaking effects of WIND EROSION!!" (Zippy)