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

Rick Delaney rick at bort.ca
Sat Mar 22 03:20:49 GMT 2008


On Mar 17 2008, Aristotle Pagaltzis wrote:
> 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.

Bear in mind I'm pretty new to Catalyst but could you not just create a
chain like

    /*/trial/23

and dispatch within the base to your different logic?  Something like

    sub base : Chained('/') PathPart('') CaptureArgs(1) {
        my ($self, $c, $base) = @_;
        $self->dispatch($base, $c);
    }

    sub view : Chained('base') PathPart('trial') Args(1) { ... }

> 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.

This sounds like separation into different virtual hosts might be
easier.

-- 
Rick Delaney
rick at bort.ca



More information about the Catalyst-dev mailing list