<br><font size=2 face="sans-serif">[ I tried to make the attributions clear
via some liberal editing...laj] </font>
<br>
<br><font size=2 face="sans-serif">> > > > Jon Warbrick started
it all by asking: </font>
<br><font size=2 face="sans-serif">> > > > [ how do I configure
DBIC::Schema models via YAML? ] </font>
<br>
<br><font size=2 face="sans-serif">> > > Brian Cassidy replied:
</font>
<br><font size=2 face="sans-serif">> > > [ yaml example edited
- for brevity ]</font>
<br>
<br><font size=2 face="sans-serif">> > Len Jaffe then asked: </font>
<br><font size=2 face="sans-serif">> > How do I make sure that my
SchemaLoader can see the config when it tries to execute </font>
<br><font size=2 face="sans-serif">> > __PACKAGE__->connection?
</font>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 face="sans-serif">> To which "Brandon Black"
Replied:</font>
<br><font size=2 face="sans-serif">> As with all things Perl, TIMTOWTDI.
While you *can* specify the connection in the Schema, </font>
<br><font size=2 face="sans-serif">> its generally not a great idea.</font>
<br><font size=2 face="sans-serif">> </font>
<br><font size=2 face="sans-serif">> Best practice would be that myapp::SchemaLoader::foo
should just contain the "loader_options" </font>
<br><font size=2 face="sans-serif">> method, and really nothing else
(no connect/connection call). Then when the Model makes the </font>
<br><font size=2 face="sans-serif">> connection using your connect_info
configuration, that's when the actual dynamic loading will </font>
<br><font size=2 face="sans-serif">> happen. </font>
<br>
<br><font size=2 face="sans-serif">I dug back into the source code and
discovered this shortly after sending my question. </font>
<br><font size=2 face="sans-serif">What I then discovered is threaded DBI
problems, which I believe can be alleviated by </font>
<br><font size=2 face="sans-serif">installing DBI from CPAN rather than
PPM. Which puts a few more yaks into my shave queue</font>
<br><font size=2 face="sans-serif">as I need to reset my development install
of perl before I'll upgrade anything on my prod box.</font>
<br>
<br><font size=2 face="sans-serif">That being said - at least I now know
how to get that info up into the YAML file.</font>
<br>
<br>
<br><font size=2 face="sans-serif">> Even better practice would be to
use the helper in create=static mode instead of create=dynamic, </font>
<br><font size=2 face="sans-serif">> so that you're not re-scanning
the table definitions at every server start. If you insist on </font>
<br><font size=2 face="sans-serif">> maintaining your database the old-fashioned
way (or have no control over it), you can regenerate </font>
<br><font size=2 face="sans-serif">> via create=static each time there's
a change in the DDL, and diff versus the previous version to </font>
<br><font size=2 face="sans-serif">> see the changes, etc. </font>
<br>
<br><font size=2 face="sans-serif">Hmm. Interesting. I'll try this
on my dev system. After I reset it.</font>
<br><font size=2 face="sans-serif">$yaks->push('create=static');</font>
<br>
<br>
<br><font size=2 face="sans-serif">> The next step beyond that is to
start maintaining your database tables using the generated </font>
<br><font size=2 face="sans-serif">> DBIC schema and the SQLT/->deploy
support. Then you won't need Loader at all.</font>
<br>
<br><font size=2 face="sans-serif">$future_yaks->push(SQLT/deploy);</font>
<br>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 face="sans-serif">> Another good practice is to move
the Schema definitions outside of the myapp:: Catalyst-app </font>
<br><font size=2 face="sans-serif">> namespace, so that you can deploy
the Schema independently for other tools that might need </font>
<br><font size=2 face="sans-serif">> access to your database. </font>
<br>
<br><font size=2 face="sans-serif">Then what? </font>
<br>
<br><font size=2 face="sans-serif"> package myapp::Schema::foo;</font>
<br><font size=2 face="sans-serif"> use base qq/some::other::namespace::Schema::foo/;</font>
<br>
<br><font size=2 face="sans-serif">Flashing back to CDBI...seems reasonable...might
do this if i end up porting from mysql to db2.</font>
<br>
<br>
<br><font size=2 face="sans-serif">Thanks for all of the advice.</font>
<br>
<br><font size=2 face="sans-serif">Len.</font>
<br><font size=2 face="sans-serif">$c->model('len::yaks')->find('shears');</font>
<HTML><BODY><P><hr size=1></P><br>
<P><br>
This transmission may contain information that is privileged,<br>
confidential, legally privileged, and/or exempt from disclosure<br>
under applicable law. If you are not the intended recipient, you<br>
are hereby notified that any disclosure, copying, distribution, or<br>
use of the information contained herein (including any reliance<br>
thereon) is STRICTLY PROHIBITED. Although this transmission and<br>
any attachments are believed to be free of any virus or other<br>
defect that might affect any computer system into which it is<br>
received and opened, it is the responsibility of the recipient to<br>
ensure that it is virus free and no responsibility is accepted by<br>
JPMorgan Chase & Co., its subsidiaries and affiliates, as<br>
applicable, for any loss or damage arising in any way from its use.<br>
If you received this transmission in error, please immediately<br>
contact the sender and destroy the material in its entirety,<br>
whether in electronic or hard copy format. Thank you.<br>
</P></BODY></HTML>