[Catalyst] Static file problem

Vsevolod (Simon) Ilyushchenko simonf at cshl.edu
Tue Mar 15 20:00:16 CET 2005


Hi,

I'm trying to run my Catalyst app under Apache, so the URLs look like
http://localhost/hops/beer/list etc. The problem is that static files 
are not server correctly in this case.

Consider the following code (below). On the first request to serve
http://localhost/hops/maypole.css

the CSS file is displayed correctly, but on the second one the regex 
action is not found, and the url gets forwarded to

http://localhost/hops/maypole.css/list

which of course does not exist.

Debugging this, I found that the iteration over 
$self->actions->{compiled} in Catalyst::Engine::Action does not happen 
on the second invocation. However, if I use Data::Dumper to print 
$self->actions->{compiled}  right before the iteration, everything works.

Thanks,
Simon

package AAA;

use strict;
use utf8;
use Catalyst qw/-Debug FormValidator FillInForm Session::FastMmap Static 
SubRequ
est/;

     AAA->config(
                 root    =>  '/usr/local/apache2/htdocs/hops',
                 uri_base => 'hops'
     );

     AAA->action(

                 '/^.*\.css$/' => sub {
                         my ( $self, $c ) = @_;
                         my $path = $c->req->path;
                         my $base = $c->config->{uri_base};
                         $path =~ s/^$base//g;
                         $c->req->path($path);
                         $c->serve_static('text/css');
                 },

     );


1;

-- 

Simon (Vsevolod ILyushchenko)   simonf at cshl.edu
				http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81



More information about the Catalyst mailing list