in reply to Re^2: Devel::GC::Helper + DBI (easy)
in thread Devel::GC::Helper + DBI

I even went so far as to implement FIRSTKEY in DBI.xs, which did make my error go away, but made Devel::GC::Helper get stuck in an infinite loop.

If your FIRSTKEY didn't return an empty list (or undef?) then you might cause an infinite loop.

It'd be interesting to figure out what causes this failure of not finding DBI::FIRSTKEY. You seem in a good position to do that, already having a test case and jumping into the C debugger with it. :)

- tye        

Replies are listed 'Best First'.
Re^4: Devel::GC::Helper + DBI (easy)
by nmerriweather (Friar) on Sep 30, 2006 at 01:05 UTC

      I explained why the missing DBI::FIRSTKEY() incorrectly gives a confusing error message about not finding an auto/DBI/FIRSTKEY.al file. Last I read that thread there were no real explanation about why the DBI::FIRSTKEY() method isn't found (other than my guess that "it doesn't exist") or why Devel::GC::Helper tries to look for it.

      I revisited my testing and found that there isn't a DBI::FIRSTKEY() but things like a DBI::db::FIRSTKEY(). So the question becomes why is Devel::GC::Helper finding a tied hash blessed into DBI (not DBI::db or some other class) or acting like it is.

      - tye        

        Just today, after 2 years of DBI use w/o this problem, it pops up.

        Occurs during compile -- a 'use' of an application module is sufficient to set it off. 'use DBI' by itself does not trigger the problem.

        I haven't touched any of the modules associated w/ the perl installation, v. 5.8.7 from Activestate. I have been changing my application code, but the same sort of changes as usual.

        I have replaced the Perl install dir w/ a backup from a few days ago -- problem persists.

        SDE is Komodo, which has been getting into "Not Responding" mode more than usual.

        After adding the method to the top-level scope of DBI, the error message about not being able to locate FIRSTKEY.al goes away, BUT compile is kicked out from DBI, now with no message.

        AND: The current DBI module has the FIRSTKEY() on line 1335, below the top scope of DBI.pm; see below. The previous version of DBI, v 11.43 2004/02/01, has the same code. Adding the recommended sub DCL does not change things.



        ***********************************************************
        ***********************************************************

        <c>
        # $Id: DBI.pm 6755 2006-08-06 21:21:03Z timbo $
        # vim: ts=8:sw=4
        #
        # Copyright (c) 1994-2004 Tim Bunce Ireland
        ...
        #
        --------------------------------------------------------------------
        # === OPTIONAL MINIMAL BASE CLASSES FOR DBI SUBCLASSES ===

        # We only define default methods for harmless functions.
        # We don't, for example, define a DBD::_::st::prepare()
        { package # hide from PAUSE

        DBD::_::common;
        # ====== Common base class methods ======
        use strict;
        # methods common to all handle types:

        sub _not_impl {
        my ($h, $method) = @_;
        $h->trace_msg("Driver does not implement the $method
        method.\n"); return; # empty list / undef
        }
        # generic TIEHASH default methods:
        sub FIRSTKEY { }
        sub NEXTKEY { }
        sub EXISTS { defined($_[0]->FETCH($_1)) } # XXX undef?
        sub CLEAR { Carp::carp "Can't CLEAR $_[0] (DBI)" }
        ***********************************************************
        ***********************************************************
        <c/>