Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Accept custom connection callback sub(s) #19

Closed
rwstauner opened this Issue · 4 comments

2 participants

@rwstauner

I think it would be really handy if you could specify a coderef to be executed when the database is connected.

I have a few applications where it would be great to use this (in fact I could replace a lot of icky code with this module),
but I have custom actions that happen after connecting.

For example:

  • set schema search path
  • connect additional databases (sqlite)
  • set job priority

I took a look at the code and i think it would be fairly simple to add to _connect.

Is this something you'd be interested in having in the main module?
I'd be happy to whip up the code and submit a pull req if you think that'd be a good feature.

It looks like I could easily subclass DBIx::Connector or one of the drivers and override _connect which would get me the same thing, but I think it would be a handy feature to have in the main module.

What do you think?

I guess a before-connect sub could be handy, too, so that you could lazily set up (or reinitialize) a proxy connection or something like that.

@theory
Owner

Replicates issue #8.

@theory theory closed this
@rwstauner

Sorry about that... I glanced at the other issues but I guess I didn't see that. Thanks for the tip, I'll check that out!

@rwstauner

Oh, It's the Callbacks that I had recently learned of... I've got that as an open tab in my browser somewhere... guess I better check it out. Thanks again!

@theory
Owner

No problem. :-)

@rwstauner rwstauner referenced this issue from a commit in rwstauner/dbix-connector
@rwstauner rwstauner Mention the 'connected' DBI Callback from constructor Pod
to avoid having more issues like gh-8 and gh-19 opened.
3e8b520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.