[Catalyst] Serving static content

samwyse samwyse at gmail.com
Mon Jun 13 16:29:06 CEST 2005

On 6/13/05, Chisel Wright <chisel at herlpacker.co.uk> wrote:
> On Mon, Jun 13, 2005 at 10:56:10AM +0200, Marcello wrote:
> > Static content would be better served by apache than any mod_perl app,
> > but moving it out of Catalyst you end up having no static content when
> > using script/MyApp_server.pl; also, no auth checking would be performed
> > on those files.
> Assuming I put my static content into /static, am I right in thinking
> that if/when I move to apache/mod_perl, I can just insert a <Location>
> for /static so that it's handled by the server, and thus these requests
> never make it to the Catalyst app?
> Until that point, during development, Catalyst gets those requests, and
> just knows to serve them statically itself ..

That reminds me of a question.  Suppose that one intentionally wants
different behavior for an app when running under Apache/mod_perl vs
server.pl; for example, serving up static content.  What's the best
way to determine the invocation method, and what's the best way to
turn sections of code on and off?  Without testing, I'm imagining
something like this:

if (defined $INC{Catalyst::Engine::HTTP}) {
  require MyApp::Static;
  import MyApp::Static;

More information about the Catalyst mailing list