[Catalyst] Re: Quick Catalyst::Plugin::SubRequest notes

Aristotle Pagaltzis pagaltzis at gmx.de
Mon Mar 17 11:48:07 GMT 2008


* Pedro Melo <melo at simplicidade.org> [2008-03-17 11:20]:
> I needed that once, and after advise from mst, I used a base
> controller. Basically, I implemented the entire chain in a base
> controller, and then I create a normal controller, that defines
> the base URL (in your case /clinicXY). So each /clinicXY would
> have a different controller, with a common base class
> implementing your stuff.
>
> This worked very well. Of course, I needed just 8 of those
> clinicXY bases. If you have some requirement like NNNN such
> bases, you might need another path.

Yes, he told me the same on IRC and I was actually planning to go
that route. Except that the set of `clinicXY`, `clinicYZ` etc
strings come from the database and can change at runtime. So I’d
need to create and destroy controller classes on the fly… uhm,
not good.

Also, there are two bits of logic, one shared by all staff-only
pages and one shared by all public pages. So dispatching them
through two separate chains and using the base in each chain to
run the respective logic seems like a good way to address that.

Finally, I like the fact that public URIs are dispatched through
a separate chain from staff-only ones, because it frees me from
having to be very careful with my auth checks. Only the things I
put into the Portal controller can ever be reached by the public
anyway.

The only thing I don’t like about this arrangment is that some
public pages share both their template and their database queries
with the corresponding staff-only pages. (They differ in wrapper
template only.) Forwarding to the staff-only chain after setting
a flag to relax auth checks seems the most concise way to take
care of those pages – except that it doesn’t seem possible to
forward to an entire chain, only to a single action.

So I have to issue a subrequest.

Or do I?

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list