title: Where do I put persistent data in Catalyst?
body: <p>I am writing a Catalyst web application that presents some data that does not change in between requests. I want to load this data when the application starts and stick them somewhere so that the relevant controllers can use them. Where should I load this data and where should I store it? At first I tried to load it in the main <code>App.pm</code> file and put them into the application config. This works, but it’s ugly, since the <code>App.pm</code> file gets littered by a lot of loading subs that don’t really belong together:</p>
  
  <pre><code>__PACKAGE__-&gt;config(this =&gt; load_this());
  __PACKAGE__-&gt;config(that =&gt; load_that());
  # et cetera
  </code></pre>
  
  <p>Then I figured I could load some of the data in the controller that uses them and store them in the controller’s config hash. This is not perfect either, because some of the data is needed in more than one controller.</p>
  
  <p>I also thought I could localize the data to the controller instead of sharing them. This feels nice, because I would have all the code that works with the data more or less on one place. The problem is that the controller would also have to render parts of the resulting page for other controllers – for example if the title page controller wanted to display a list of recent news, it would have to ask the news controller to render the list. This does not seem to be the preferred way of doing things in Catalyst.</p>
  
  <p>How would you solve this?</p>
  
  <p>(The nature of the data: This is a website of a music festival. There is a line-up, a list of sponsors and other simple data pulled from YAML files, because database would be overkill and hard to edit.)</p>