[Catalyst] Help with static and RegEx

Mike McKay mike at vdomck.org
Wed Jun 29 10:32:00 CEST 2005


So I am trying to serve all static pages out of the root directory. 
Should be simple, but I am having trouble. It seems that the regex 
matches, but then the handler doesn't execute:

# match anything after the slash that is not a slash
sub files : Regex('/*([^/]*\.(css|js|html))$') {
     my ( $self, $c ) = @_;
     my ($file, $extension) = @{ $c->req->snippets };
     $c->req->path( "$file" );
     $c->serve_static;
}


But this is what happens:

[Wed Jun 29 09:08:41 2005] [catalyst] [debug] 
**********************************
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] * Request 2 (0.333/s) [26154]
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] 
**********************************
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] Requested action is 
"booking/style.css" and matched "/*([^/]*\.(css|js|html))$"
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] Snippets are "style.css css"
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] "GET" request for 
"booking/style.css" from 192.168.1.3
[Wed Jun 29 09:08:41 2005] [catalyst] [debug] Rendering template 
"booking/style.css"
[Template::Service] process(booking/style.css, HASH(0x91be5fc))
[Wed Jun 29 09:08:41 2005] [catalyst] [error] Couldn't render template 
"file error - booking/style.css: not found"
[Wed Jun 29 09:08:41 2005] [catalyst] [info] Request took 0.023221s 
(43.064/s)

So it is trying to serve the template instead. And if I insert debug 
code in the files method it never shows it. What is happening?

Mike




More information about the Catalyst mailing list