[Catalyst] Where to put template files?
jjn1056 at yahoo.com
Fri Jun 9 03:29:22 CEST 2006
i dont want to change INCLUDE_PATH in Template Toolkit
because if i specify a direct path the testserver wont
Actually Catalyst is pretty smart to help you with
this sort of thing. First of all it almost ways uses
the catalyst application root, not the filesystem
root, so there is no trouble if the development and
production servers use different paths. I have this
issue and I promote to production from the same DVN
tree as is used in development.
I think also there was a comment about using the .yml
file to help with this. As I mentioned it usually
isn't necessary, but it is a great way to consoladate
your configuration. The YAML thing really got me at
first because I was a newb to it and the documentation
was baffling to me. Here's an example from my yml
file where I set some config stuff for a template
This is similar to the example I have you before where
I was setting up config in the actual class. I did
that a lot at first.
This is config for a view called
"myapp::View::tt_html" located in the View directory.
As you can see only one of the values is specifying an
absolute path. The rest pick up their root from
catalyst. In development this is
/mnt/hgfs/catalyst/myapp, but in production it's
I know getting used to the yaml syntax can be trouble,
but there is a command line yml compiling you get when
you install yaml which can help you translate perl
structures to yml structures to help get you started.
It's call ysh and you invoke is by typing 'ysh' from
the command prompt (if you've installed YAML, which is
likely true if you are using catalyst!
So the short answer is that you should have no trouble
if your dev and prod use different path prefixes,
assuming everything else is the same regarding the
perl installation and paths, and whatever other
includes you might need.
Hope this helps out, john
--- "Dr. Jennifer Nussbaum" <bg271828 at yahoo.com>
> > On 08/06/06, *Dr. Jennifer Nussbaum*
> > > wrote:
> > You can do something like:
> > SetHandler perl-script
> > PerlResponseHandler MyApp
> > Alias /myapp/static
> > Order allow,deny
> > Allow from all
> > SetHandler default-handler
> > Thank you!!!
> > But one question--where do my templates go?
> Right now their under,
> > lets say, /path/to/myapp/root/. And i dont
> want to change anything
> > in MyApp.pm so i can
> > keep running it with the builtin testing
> If everything is working fine under the test server,
> then it should Just
> Work (tm) under apache. Templates don't have to be
> Thank you for this and thank you to everyone whose
> responded in detail about setting this up but i
> think my main question is still out there.
> i dont want to change INCLUDE_PATH in Template
> Toolkit because if i specify a direct path the
> testserver wont work, right?
> And i understand that this will "Just Work" under
> apache if i leave everything where it is but thats
> not what im asking. i want to know where to put it
> if i DO need to move thing. Consider this:
> Right now i can create MyApp anywhere, it can be
> /home/jen/temporary_projects/myapp/lib/MyApp.pm. And
> then if I run the testserver it will find my
> templates at
> But if i run this under apache i DONT want to keep
> MyApp at /home/jen/temporary_projects, i want to
> move it to something like
> /usr/local/web/modules/MyApp.pm where the rest of my
> webapps are, and apache points to them. But then i
> cant keep my templates in ~/temporary_projects or
> they wont be found. BUT if I make something like
> /usr/local/web/templates/myapp/ and point
> INCLUDE_PATH to THAT, then the testserver wont find
> it if im running on the development version in
> im sorry if im not explaining things well but what i
> really want is way that i can do two things: 1. run
> a development version with the testserver and run a
> production version with apache, and 2. do this
> without changing code between the versions (changing
> the code to get the production version to point to
> different directories that is).
> is that clearer? Thanks for keeping on reading!!
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com >
> Catalyst mailing list
> Catalyst at lists.rawmode.org
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Catalyst