[Catalyst] A domain-cued application

Adam Jacob adam at stalecoffee.org
Thu Apr 27 08:13:21 CEST 2006

On Apr 26, 2006, at 10:50 PM, Matija Grabnar wrote:

> I'm developing a small application that we would like to sell (as a  
> part
> of a much larger package) to a number of customers. Most often, the
> hosting for that customer will be done by us, in a vhost on one of our
> servers. Since the load from the application will usualy be very  
> small,
> there is NO chance of setting up a separate server, (not even a  
> separate
> apache tree) for each customer.
> Idealy, I would like catalyst to look up the domain it's being used  
> with
> currently (on an apache with multiple vhosts instalation), and select
> the appropriate database for that customer. That way, I can create the
> application for a new customer by simply creating a new vhost and new
> database for them, and the application can be very simple.
> Unfortunately, I can't see a way to do that with Catalyst and  
> DBIx::Class.
> The alternative is to design the application itself to be domain- 
> aware,
> having the domain as a key in a number of tables. Which of course  
> would
> make the application more complex and harder to write.
> Can anybody supply any clues on how to achieve the first option? Or is
> there a third one?

It looks like you can achieve what you're looking for with  
DBIx::Class::Schema, by calling:

   # Elsewhere in your code:
   my $schema1 = Library::Schema->connect(
     { AutoCommit => 0 },

Where the values for the above are inherited from a configuration  
file for your app.  You could easily use, say, an environment  
variable to configure which configuration file to load based on the  


More information about the Catalyst mailing list