We do something along those lines - although for very different
reasons - our has_a and has_many relationships are defined in the
Model.pm, not the individual tables' modules, ie
This::Table->has_a(this_col => That::Table);
That::Table->has_many(that_col => This::Table);
The reason for this is that we use an auto discovery framework, so
there's no guarantee that This/Table.pm even exists.
So, it's a different purpose to yours, but can be done. Depending on
exactly what you're trying to do, you could parse a text file to
produce statements like the above, or code them into your Model
directly.
Hope that helps.
RET
________________________
Sent from my iPhone
On 14/03/2009, at 5:08 AM, Ascii King <[email protected]> wrote:
Is there some way to place all of the relationship specifications
into a file so that I don't have to go out and type them in each time?
For example, I can specify a bunch of SQL commands in a text file
and have sqlite3 read them and turn them into a database full of
data. Now I want to have a text file where, when I run it, it
automatically opens up my Schema .pm files and puts the
relationships in.
I want this so that I can send out the files necessary to build my
database and the relationships.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/