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

Matt S Trout dbix-class at trout.me.uk
Tue Jun 3 07:34:25 BST 2008


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

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 :)

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