[Catalyst-dev] RT #36209: convert internal path seperators for clarity

John Napiorkowski jjn1056 at yahoo.com
Tue Jun 3 16:09:51 BST 2008


Apologies for top posting, and apologies for sending so many blank responses to the list.  I guess there is some strange incompatibility with my client or something, but for some reason this happens only on this list.  I'll switch clients to something that won't cause this strange problem.  My intended reply is below.

John Napiorkowski

--- On Tue, 6/3/08, Matt S Trout <dbix-class at trout.me.uk> wrote:

> From: Matt S Trout <dbix-class at trout.me.uk>
> Subject: Re: [Catalyst-dev] RT #36209: convert internal path seperators for clarity
> To: jjn1056 at yahoo.com, "Development of the elegant MVC web framework" <catalyst-dev at lists.scsys.co.uk>
> Date: Tuesday, June 3, 2008, 2:34 AM
> On Mon, Jun 02, 2008 at 01:11:15PM -0700, John Napiorkowski
> wrote:
> > I've always felt iffy about namespace being part
> of the controller class in this way.  The examples you gave
> (regarding /auto, etc and partitioning controllers) are the
> only ones I can think of as well.  However I have to wonder
> if this is too much tying of information to a controller?  I
> guess the fundamental question I have is if a controller
> should know it's namespace, or if that attribute should
> be assigned to it from from external class or process.  From
> my thinking a controller class should only know enough about
> itself to work, everything else should be passed into it
> from the dispatcher or from some sort of adapter class that
> 'wraps' it for consumption via the dispatching
> mechanism.  So I guess I am wondering if we are at the
> proper level of abstraction here?
>
> The controller uses the namespace when it calls
> register_actions; I think
> that's correct since that's it telling the
> dispatcher where to add its
> actions to the tree - or at least the controller should be
> able to supply
> a default - it doesn't really seem wrong to me that
> Root.pm can specify that it
> should by default attach its actions under /.

I guess I've just seen a lot of namespace abuse that my instinct is to severely reduce it's user accessibility.  But I can't really think of something more elegant that does what it needs, ie everything you mentioned already :)

The types of abuse that I've seen typically play with namespace in base controllers that then get used in crazy multiply inheritances so that in the end you have no idea what's happening.  Also I know sometimes $c->namespace gets used in controllers and views.  I'm not sure if this should be an accepted practice or not.

>
> Post-setup it doesn't really need it at all; action_for
> uses it but that's
> basically just a matter of convenience; no reason you
> couldn't add a
> dispatcher API that looks up the controller to find the
> action rather than
> looking up the namespace - and that's exactly what
> we'd need to build to
> support Foo::Bar->baz style forwards anyway :)

That sounds so much saner to me.

>
> --
>       Matt S Trout       Need help with your Catalyst or
> DBIx::Class project?
>    Technical Director                   
> http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or
> deployment platform?
> http://chainsawblues.vox.com/           
> http://www.shadowcat.co.uk/servers/


      



More information about the Catalyst-dev mailing list