On Apr 15, 2010, at 5:17 AM, Tim Bunce wrote:

>    $drh = DBI->install_driver($driver);
>    $dbh = $drh->connect(...);
> 
> Assuming we added a $dbh->connecting() method, how would it be called,
> and how would the callback have been enabled prior to calling it?

In connect(), before $connect_meth, just as connected() is called in that 
method after $connect_meth.

        $dbh->connected(@orig_args);
        unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr)) {

> Why not register the callback on the driver:
> 
>    DBI->install_driver('Pg')->{Callbacks}{connect} = ...;
> 
> That'll affect all subsequent connects using that driver and won't work
> with proxy drivers like Gofer, which is why DBI docs discourage messing
> with driver handles, but it may fit your needs.

It's not my needs. Someone is creating a CPAN module I think. His needs were 
met by connected(), but I think that connecting() would be useful as well.

> If we did that (and handled backwards compatibility somewhow)
> then presumably new_child() could apply the Callbacks attribute
> which would then fire on the subsequent $dbh->connect call.

That would be cool. I, alas, have a very short supply of tuits these days.

Best,

David

Reply via email to