[Catalyst] Directory layout

Cory Watson jheephat at gmail.com
Thu Nov 8 15:11:39 GMT 2007

On Nov 8, 2007, at 8:47 AM, Gerda Shank wrote:

> The templates are not in the View directory, because the "lib"  
> hierarchy is just for Perl code. Is that right?

Yes.  The Model, Controller and View directories house the respective  
perl classes that handle those functions.

> Is "root" kind of the equivalent of "htdocs"?  What else would go in  
> the "static" subdirectory besides images? Would you put css files in  
> here? Does javascript go in static, or does it get a directory  
> underneath root?

Before I say anything, let me say: The short answer is that you can  
set things up however you want.

The 'static' directory is  similar to htdocs.  The TT view is  
configured by default to use the 'root' directory as it's path for  
templates.  The static directory is a best practice, I usually put  
'css', 'javascript' and 'images' in there.  It's a good idea to put  
all your static files under a common directory when using mod_perl  
because then you can tell apache to use the default handler for all  
files under that path.  Using mod_perl to serve images is Bad Mojo.   
It's probably also a good idea for a bunch of other reasons.

> Are any parts of the layout created by "catalyst.pl" changeable, or  
> would it break Catalyst to rename them? If, for example, "root" was  
> changed to "htdocs", or you didn't use the "static" directory?

You probably could to this, but the default layouts are sort of a best  
practice.  I'd use the defaults until you understand them better.

> Sorry for all the questions. I've been studying the documentation,  
> but haven't had much like finding explanations for these things, and  
> I'm not sure where to look in the code.

No worries.  It's better than doing things wrong and then  
complaining. ;)

Cory 'G" Watson

More information about the Catalyst mailing list