[Catalyst] Adding relationships to loaded CDBI models

Rob Kinyon rob.kinyon at gmail.com
Thu Jun 16 19:52:15 CEST 2005

> All you have to do is supply a dbi path to the myapp_create.pl helper
> script, it'll create classes for your tables. An example:
> gabb at spalato:~/MyApp$ sqlite3 /tmp/myapp.db < myapp.sql
> gabb at spalato:~/MyApp$ script/myapp_create.pl model CDBI CDBI dbi:SQLite:/tmp/myapp.db
> created "/home/gabbana/MyApp/script/../lib/MyApp/M/CDBI.pm"
> created "/home/gabbana/MyApp/script/../lib/MyApp/M/CDBI"
> created "/home/gabbana/MyApp/script/../lib/MyApp/M/CDBI/Item.pm"
> Then you add the relationships in MyApp::M::CDBI::Item, and _NOT_ in CDBI.pm.
> Re-running the helper script won't overwrite existing modules btw, so you can run it everytime you update your SQL.

This brings up an interesting point - what if you're not using SQLite,
but instead are using MySQL/Oracle/Sybase/etc. Some of those dbi:
strings can get quite long. What's a best practice for handling that?


More information about the Catalyst mailing list