Sometimes, but not always, I have problems when using DBIx::Interp in
combination with DBI.

DBIx::Interp seems to be implemented as sub-class of DBI, in line with the
recommended practices for this in the DBI docs.

I don't know what triggers it, but the symptom looks like this:

Can't locate object method "selectcol_arrayref_i" via package "Apache::DBI::db"

The method name is not the issue, it's the name space being searched. This 
method
is part of DBIx::Interp.

Maybe there is an easy bug in the new() or connect() methods of DBIx::Interp,
so I'll paste them below in case you can spot them. 

So far, our only workaround for this issue is to quit using DBIx::Interp when we
find it triggers the bug in mod_perl, and use 'dbi_interp()' directly instead. 

For the longer term, I'm considering switching to using DBIx::Simple with the
SQL::Interp integration instead. This would avoid using DBIx::Interp, and likely
would avoid the trigger.

###
my $priv = 'private_DBIxInterpolate';
sub new {
    my $class = shift;
    my $dbh;

    if (UNIVERSAL::isa($_[0], 'DBI::db')) {
        $dbh = shift;
    }
    elsif (ref $_[0] eq 'ARRAY') {
        $dbh = DBI->connect(@{shift @_});
        return if ! defined $dbh;
    }
    else {
        croak 'DBIx::Interp::db::new() not passed database connection';
    }

    my $interp = SQL::Interp->new(($dbh || ()), @_);
    my $self = $dbh;
    bless $self, $class;
    my $private = $self->{$priv} = {};
    $private->{stx} = $self->prepare_i();
    $private->{interp} = $interp;

    # weaken circular references to allow garbage collection
    weaken $private->{stx}->{dbx};
    weaken $private->{interp}->{dbh};

    return $self;
}


sub connect {
    my $class = shift;
    my $self;
    eval {
        my $dbh = DBI->connect(@_);
        return if ! $dbh;
        $self = DBIx::Interp->new($dbh);  #Q: OK?
    };
    if ($@) { croak $@; }
    return $self;
}





###


Thanks!

    Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   m...@summersault.com     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


Reply via email to