<br><div><span class="gmail_quote">On 8/9/06, <b class="gmail_sendername">Tim Keefer</b> <<a href="mailto:tkeefer@gmail.com">tkeefer@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>unfortunately I didn't make note of the versions before I upgraded.</div></blockquote><div><br>What exactly is broken? What error messages/behavior happen that you expected to be different? </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>We're trying to accomplish two things,<br>1) pull database connection info out of our conf so the models can be shared between the web apps, scripts, etc.
<br>2) avoid extraneous connects to the database. <br><br>Here's the exact code reference:<br>
<br>[.......] <br></div></blockquote><div><br>Well, you could handle the configuration side of your issue easily without a coderef in connect_info, so I can only assume you're doing all of this because you're trying to share a single $dbh with non-DBIC code in the same running interpreter? Have you considered just connecting a $schema object using your info the normal way, and "sharing" the $dbh via mechanisms like:
<br><br>sub my_code_that_does_not_use_dbic_but_gets_dbh_from_a_dbic_schema {<br> my ($self, $schema, @other_stuff) = @_;<br> my $dbh = $schema->storage->dbh;<br> $dbh->do(...);<br> return;<br>}<br><br>
This would allow DBIC to manage the $dbh for you and still give access to other code. DBIC has hundreds of lines of code devoted specifically to managed $dbh's better than your subroutine can - you should let it do the work for you if possible.
<br><br>The only known issue at the moment for 0.07000 sharing $dbh with other code is that when your connected schema object goes out of scope, its going to forcefully disconnect the active $dbh connection that other code might be using. There's a fix for that in -current, I'll make sure it makes it into trunk for
0.07001 too.<br><br>-- Brandon <br></div><br></div>