[Catalyst] Non-virtualhost environment
Marcello
m.romani at spinsoft.it
Mon Nov 21 14:15:04 CET 2005
Sean Davis ha scritto:
> This is a naïve question, but I'll ask. I want to develop a simple
> application that will live at a location like:
>
> www.example.com/application/
>
> rather than www.example.com. I know that I can make location matches using
> path matching, but the catalyst default is SO NICE (i.e., not having to
> specify anything about the path for the method)! Is there a way to define
> the "www.example.com/application/" as the base URL for location matching?
>
> Thanks,
> Sean
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
AFAIK, you don't have to.
You just say something like:
PerlModule MyApp
<Location /application>
SetHandler perl-script
PerlResponseHandler MyApp
</Location>
and everything Just Works (TM).
The only thing you must be careful with are redirects, form atcions, etc.
With Catalyst 5.33 I prepend [% base %] to every href I write in the
templates ($c->req->base in the code).
For example, instead of
<a href="/products/do_edit">Apply</a>
I write
<a href="[% base %]products/do_edit">Apply</a>
Also, instead of writing
$c->res->redirect('/products/list');
I wite
$c->res->redirect( $c->req->base . 'products/list' );
I belive the $c->uri_for method in the newer releases is meant to avoid
repeating 'base' everywhere.
--
Marcello Romani
Developer
Spin s.r.l.
Reggio Emilia
http://www.spinsoft.it
More information about the Catalyst
mailing list