[Catalyst] Configuring individual models via config file with DBIx::Class:Schema

Alan Schwartz alansz at cybermango.org
Mon Mar 22 19:15:15 GMT 2010


I have an application using DBIx::Class::Schema. In the 
application config file, I have:

<Model::DB>
  schema_class MyApp::Schema
<connect_info>
  ...various necessary stuff here...
</connect_info>
</Model::DB>

<Controller::One>
  someattribute value
</Controller::One>

<DB::Two>
  anotherattribute anothervalue
</DB::Two>


The first two of these blocks do what I expect -- my models
get build from the Schema/Result files, I get connections, etc.
And in Controller/One.pm, I can access $self->{someattribute}

But I can't for the life of my figure out how I can get anotherattribute
into the config for an individual model based on the schema.
That is, I'd like methods in DB::Two objects to have access
to $self->{anotherattribute}

In addition to the above, I have tried:

* Variations on the config block (<myapp::Model::DB::Two>, <Model::DB::Two>,
  <Two>, even <MyApp::Schema::Result::Two>)
* Putting that block within the <Model::DB> block, again with all 
  those variations

I haven't found the answer so far in searching this mailing list
or the web. Is this possible?  What am I missing here? 

Thanks in advance!

 - Alan





More information about the Catalyst mailing list