[Catalyst] [Beginner] Understanding actions and controllers - not!

Ben van Staveren benvanstaveren at gmail.com
Mon Aug 23 21:17:40 GMT 2010


try using /static/css/main.css ;)

Ekki Plicht (DF4OR) wrote:
> Hi.
> Somewhen over the weekend I had the impression that I em beginning to 
> understand how actions and controllers work. I was wrong.
>
> Starting with a bare minimum project, only using the standard root controller 
> with three standard subs: index, default, end.
>
> I created a view, then set up an 'index.tt' template, as well as a 
> 'error404.tt' template. index.tt contains the following line (via a wrapper):
> 	<link rel="stylesheet" href="static/css/main.css" type="text/css" />
>
> In the default action sub I have
> 	$c->stash->{template} = 'error404.tt';
>
> Using:
> /localhost:3000/ -> renders index.tt nicely
> /localhost:3000/foo -> renders error404.tt nicely
> /localhost:3000/foo/bar -> renders error404.tt broken, the css file is not 
> found!
>
> The debug screen says:
> [info] *** Request 12 (0.000/s) [21763] [Mon Aug 23 23:02:52 2010] ***
> [debug] "GET" request for "foo/bar" from "127.0.0.1"
> [debug] Path is "/"
> [debug] Arguments are "foo/bar"
> [debug] Rendering template "error404.tt"
> [debug] Response Code: 404; Content-Type: text/html; charset=utf-8; Content-
> Length: 3861
> [info] Request took 0.100899s (9.911/s)
> [...]
>
> [info] *** Request 13 (0.000/s) [21763] [Mon Aug 23 23:02:52 2010] ***
> [debug] "GET" request for "foo/static/css/main.css" from "127.0.0.1"
> [debug] Path is "/"
> [debug] Arguments are "foo/static/css/main.css"
> [debug] Rendering template "error404.tt"
> [debug] Response Code: 404; Content-Type: text/html; charset=utf-8; Content-
> Length: 3877
> [info] Request took 0.101907s (9.813/s)
> [...]
>
> The default sub is declared as:
> 	sub default :Path {
>
>
> What am I missing here? Why is the first pathpart (1st argument) now suddenly 
> prepended to my static path? All templates are in the same directory under 
> root/
>
> TIA,
> Ekki
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>   

-- 
Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren at gmail.com




More information about the Catalyst mailing list